From 5723dee3162008521beacb050c62254b6c68f69d Mon Sep 17 00:00:00 2001 From: Nick Sieger Date: Mon, 22 Aug 2022 08:41:08 -0500 Subject: [PATCH] pull: only skip pull when policy is `missing`/`if_not_present` Fixes #9773. Signed-off-by: Nick Sieger --- pkg/compose/pull.go | 9 --------- pkg/e2e/compose_test.go | 7 +++++++ .../image-present-locally/docker-compose.yaml | 1 + 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/pkg/compose/pull.go b/pkg/compose/pull.go index addf2ad2..a545e8e3 100644 --- a/pkg/compose/pull.go +++ b/pkg/compose/pull.go @@ -96,15 +96,6 @@ func (s *composeService) pull(ctx context.Context, project *types.Project, opts }) continue } - default: - if _, ok := images[service.Image]; ok { - w.Event(progress.Event{ - ID: service.Name, - Status: progress.Done, - Text: "Skipped - Image is already present locally", - }) - continue - } } if s, ok := imagesBeingPulled[service.Image]; ok { diff --git a/pkg/e2e/compose_test.go b/pkg/e2e/compose_test.go index 7f8c46ec..127076a6 100644 --- a/pkg/e2e/compose_test.go +++ b/pkg/e2e/compose_test.go @@ -131,6 +131,13 @@ func TestComposePull(t *testing.T) { assert.Assert(t, strings.Contains(output, "simple Pulled")) assert.Assert(t, strings.Contains(output, "another Pulled")) + + // verify default policy is 'always' for pull command + res = c.RunDockerComposeCmd(t, "--project-directory", "fixtures/compose-pull/simple", "pull") + output = res.Combined() + + assert.Assert(t, strings.Contains(output, "simple Pulled")) + assert.Assert(t, strings.Contains(output, "another Pulled")) }) t.Run("Verify a image is pulled once", func(t *testing.T) { diff --git a/pkg/e2e/fixtures/compose-pull/image-present-locally/docker-compose.yaml b/pkg/e2e/fixtures/compose-pull/image-present-locally/docker-compose.yaml index ebc0df07..92207779 100644 --- a/pkg/e2e/fixtures/compose-pull/image-present-locally/docker-compose.yaml +++ b/pkg/e2e/fixtures/compose-pull/image-present-locally/docker-compose.yaml @@ -1,4 +1,5 @@ services: simple: image: alpine:3.13.12 + pull_policy: missing command: top