Handle case of missing GH variables (#492)
Closes #482
I traced the problem to where buildx parses the cli args
([here](fa4461b9a1/util/buildflags/cache.go (L14))),
and confirmed it applies defaults based on GHA environment variables and
ignores the cacheTo/cacheFrom directive altogether when the variables
aren't available.
The fix is to ignore the GHA cache directive when it the upstream parser
ignores it.
This commit is contained in:
@@ -468,9 +468,8 @@ func (c CacheFrom) validate(preview bool) (*controllerapi.CacheOptionsEntry, err
|
||||
return nil, err
|
||||
}
|
||||
if len(parsed) == 0 {
|
||||
// This can happen for example if we have a GHA cache but no GitHub
|
||||
// environment variables set.
|
||||
// Shouldn't happen...
|
||||
// This can happen for example if we have a GHA cache configuration but no GitHub
|
||||
// environment variables set. Ignore the cacheFrom entry in this case.
|
||||
return nil, nil
|
||||
}
|
||||
return parsed[0], nil
|
||||
@@ -677,9 +676,8 @@ func (c CacheTo) validate(preview bool) (*controllerapi.CacheOptionsEntry, error
|
||||
return nil, err
|
||||
}
|
||||
if len(parsed) == 0 {
|
||||
// This can happen for example if we have a GHA cache but no GitHub
|
||||
// environment variables set.
|
||||
// Shouldn't happen...
|
||||
// This can happen for example if we have a GHA cache configuration but no GitHub
|
||||
// environment variables set. Ignore the cacheTo entry in this case.
|
||||
return nil, nil
|
||||
}
|
||||
return parsed[0], nil
|
||||
|
||||
Reference in New Issue
Block a user