Skip to content

Commit

Permalink
auto-update: fix authfile label
Browse files Browse the repository at this point in the history
Make sure that the container's authfile label is used when pulling down
a new image.

[NO TESTS NEEDED] since we need to add authfile tests to the main
branch.

Fixes: containers#11171
Signed-off-by: Valentin Rothberg <[email protected]>
  • Loading branch information
vrothberg committed Sep 10, 2021
1 parent 405507a commit e18bba5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/autoupdate/autoupdate.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ func autoUpdateRegistry(ctx context.Context, image *libimage.Image, ctr *libpod.
return report, nil
}

if _, err := updateImage(ctx, runtime, rawImageName, options); err != nil {
if _, err := updateImage(ctx, runtime, rawImageName, authfile); err != nil {
return report, errors.Wrapf(err, "error registry auto-updating container %q: image update for %q failed", cid, rawImageName)
}
updatedRawImages[rawImageName] = true
Expand Down Expand Up @@ -379,9 +379,9 @@ func newerLocalImageAvailable(runtime *libpod.Runtime, img *libimage.Image, rawI
}

// updateImage pulls the specified image.
func updateImage(ctx context.Context, runtime *libpod.Runtime, name string, options *entities.AutoUpdateOptions) (*libimage.Image, error) {
func updateImage(ctx context.Context, runtime *libpod.Runtime, name, authfile string) (*libimage.Image, error) {
pullOptions := &libimage.PullOptions{}
pullOptions.AuthFilePath = options.Authfile
pullOptions.AuthFilePath = authfile
pullOptions.Writer = os.Stderr

pulledImages, err := runtime.LibimageRuntime().Pull(ctx, name, config.PullPolicyAlways, pullOptions)
Expand Down

0 comments on commit e18bba5

Please sign in to comment.