If we tell system to never pull we should not pull
Fixes: https://github.com/containers/buildah/issues/3596 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
parent
d3b6dbe9c6
commit
1cb44dc5a1
|
|
@ -454,7 +454,7 @@ func (r *Runtime) copySingleImageFromRegistry(ctx context.Context, imageName str
|
|||
// NOTE that this is will even override --pull={false,never}. This is
|
||||
// very likely a bug but a consistent one in Podman/Buildah and should
|
||||
// be addressed at a later point.
|
||||
if pullPolicy != config.PullPolicyAlways {
|
||||
if pullPolicy != config.PullPolicyAlways && pullPolicy != config.PullPolicyNever {
|
||||
switch {
|
||||
// User input clearly refer to a local image.
|
||||
case strings.HasPrefix(imageName, "localhost/"):
|
||||
|
|
|
|||
|
|
@ -122,3 +122,23 @@ func TestPullPlatforms(t *testing.T) {
|
|||
require.NoError(t, err, "lookup busybox - by arm")
|
||||
require.NotNil(t, image, "lookup busybox - by local arch")
|
||||
}
|
||||
|
||||
func TestPullPolicy(t *testing.T) {
|
||||
runtime, cleanup := testNewRuntime(t)
|
||||
defer cleanup()
|
||||
ctx := context.Background()
|
||||
pullOptions := &PullOptions{}
|
||||
|
||||
pulledImages, err := runtime.Pull(ctx, "alpine", config.PullPolicyNever, pullOptions)
|
||||
require.Error(t, err, "Never pull different arch alpine")
|
||||
require.Nil(t, pulledImages, "lookup alpine")
|
||||
|
||||
pulledImages, err = runtime.Pull(ctx, "alpine", config.PullPolicyNewer, pullOptions)
|
||||
require.NoError(t, err, "Newer pull different arch alpine")
|
||||
require.NotNil(t, pulledImages, "lookup alpine")
|
||||
|
||||
pulledImages, err = runtime.Pull(ctx, "alpine", config.PullPolicyNever, pullOptions)
|
||||
require.NoError(t, err, "Never pull different arch alpine")
|
||||
require.NotNil(t, pulledImages, "lookup alpine")
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue