Fix permissions on cache when --no-push is set (#1445)
This commit is contained in:
parent
6c70f167df
commit
0ef3a6b525
|
|
@ -102,14 +102,17 @@ var (
|
||||||
// CheckPushPermissions checks that the configured credentials can be used to
|
// CheckPushPermissions checks that the configured credentials can be used to
|
||||||
// push to every specified destination.
|
// push to every specified destination.
|
||||||
func CheckPushPermissions(opts *config.KanikoOptions) error {
|
func CheckPushPermissions(opts *config.KanikoOptions) error {
|
||||||
|
var targets = opts.Destinations
|
||||||
|
// When no push is set, whe want to check permissions for the cache repo
|
||||||
|
// instead of the destinations
|
||||||
if opts.NoPush {
|
if opts.NoPush {
|
||||||
return nil
|
targets = []string{opts.CacheRepo}
|
||||||
}
|
}
|
||||||
|
|
||||||
checked := map[string]bool{}
|
checked := map[string]bool{}
|
||||||
_, err := fs.Stat(DockerConfLocation())
|
_, err := fs.Stat(DockerConfLocation())
|
||||||
dockerConfNotExists := os.IsNotExist(err)
|
dockerConfNotExists := os.IsNotExist(err)
|
||||||
for _, destination := range opts.Destinations {
|
for _, destination := range targets {
|
||||||
destRef, err := name.NewTag(destination, name.WeakValidation)
|
destRef, err := name.NewTag(destination, name.WeakValidation)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "getting tag for destination")
|
return errors.Wrap(err, "getting tag for destination")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue