auto update: fix usage of --authfile

The --authfile flag has been ignored.  Fix that and add a test to make
sure we won't regress another time.  Requires a new --tls-verify flag
to actually test the code.

Also bump c/common since common/pull/1538 is required to correctly check
for updates.  Note that I had to use the go-mod-edit-replace trick on
c/common as c/buildah would otherwise be moved back to 1.30.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2218315
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
This commit is contained in:
Valentin Rothberg
2023-06-29 11:34:49 +02:00
parent 10615e784b
commit d874790bc6
12 changed files with 117 additions and 13 deletions

View File

@ -806,6 +806,9 @@ type HasDifferentDigestOptions struct {
// containers-auth.json(5) file to use when authenticating against
// container registries.
AuthFilePath string
// Allow contacting registries over HTTP, or HTTPS with failed TLS
// verification. Note that this does not affect other TLS connections.
InsecureSkipTLSVerify types.OptionalBool
}
// HasDifferentDigest returns true if the image specified by `remoteRef` has a
@ -831,8 +834,15 @@ func (i *Image) HasDifferentDigest(ctx context.Context, remoteRef types.ImageRef
sys.VariantChoice = inspectInfo.Variant
}
if options != nil && options.AuthFilePath != "" {
sys.AuthFilePath = options.AuthFilePath
if options != nil {
if options.AuthFilePath != "" {
sys.AuthFilePath = options.AuthFilePath
}
if options.InsecureSkipTLSVerify != types.OptionalBoolUndefined {
sys.DockerInsecureSkipTLSVerify = options.InsecureSkipTLSVerify
sys.OCIInsecureSkipTLSVerify = options.InsecureSkipTLSVerify == types.OptionalBoolTrue
sys.DockerDaemonInsecureSkipTLSVerify = options.InsecureSkipTLSVerify == types.OptionalBoolTrue
}
}
return i.hasDifferentDigestWithSystemContext(ctx, remoteRef, sys)

View File

@ -217,9 +217,12 @@ func (s *SecretsManager) Store(name string, data []byte, driverType string, opti
}
if options.Replace {
err = driver.Delete(secr.ID)
if err != nil {
return "", fmt.Errorf("replacing secret %s: %w", name, err)
if err := driver.Delete(secr.ID); err != nil {
return "", fmt.Errorf("deleting secret %s: %w", secr.ID, err)
}
if err := s.delete(secr.ID); err != nil {
return "", fmt.Errorf("deleting secret %s: %w", secr.ID, err)
}
}

View File

@ -1,4 +1,4 @@
package version
// Version is the version of the build.
const Version = "0.55.1"
const Version = "0.56.0-dev"