Skip to content

Commit

Permalink
Merge pull request containers#679 from vrothberg/fix-10914
Browse files Browse the repository at this point in the history
pull with custom platform: handle "localhost/"
  • Loading branch information
openshift-merge-robot authored Jul 16, 2021
2 parents 383a7e3 + c51cdc0 commit ffcfe1f
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions libimage/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -394,8 +394,23 @@ func (r *Runtime) copySingleImageFromRegistry(ctx context.Context, imageName str
// very likely a bug but a consistent one in Podman/Buildah and should
// be addressed at a later point.
if pullPolicy != config.PullPolicyAlways {
logrus.Debugf("Enforcing pull policy to %q to support custom platform (arch: %q, os: %q, variant: %q)", "always", options.Architecture, options.OS, options.Variant)
pullPolicy = config.PullPolicyAlways
switch {
// User input clearly refer to a local image.
case strings.HasPrefix(imageName, "localhost/"):
logrus.Debugf("Enforcing pull policy to %q to support custom platform (arch: %q, os: %q, variant: %q)", "never", options.Architecture, options.OS, options.Variant)
pullPolicy = config.PullPolicyNever

// Image resolved to a local one, so let's still have a
// look at the registries or aliases but use it
// otherwise.
case strings.HasPrefix(resolvedImageName, "localhost/"):
logrus.Debugf("Enforcing pull policy to %q to support custom platform (arch: %q, os: %q, variant: %q)", "newer", options.Architecture, options.OS, options.Variant)
pullPolicy = config.PullPolicyNewer

default:
logrus.Debugf("Enforcing pull policy to %q to support custom platform (arch: %q, os: %q, variant: %q)", "always", options.Architecture, options.OS, options.Variant)
pullPolicy = config.PullPolicyAlways
}
}
}

Expand Down

0 comments on commit ffcfe1f

Please sign in to comment.