Skip to content
This repository has been archived by the owner on Nov 27, 2023. It is now read-only.

Add --dry-run option to pull cmd #1818

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

satotake
Copy link

@satotake satotake commented Jun 20, 2021

What I did

Add --dry-run option to pull command.
Our final goal is adding the --dry-run to up and I started with the case of pull at first.
This is a proposal.

Example usage

$ docker compose --project-directory local/e2e/compose/fixtures/dry-run-test/pull/ pull  --dry-run
SERVICE             IMAGE                           PLAN                REMOTE DIGEST
expectedFetch       hello-world                     fetch               sha256:9f6ad537c5132bcce57f7a0a20e317228d382c3cd61edae14650eec68b2b345c
expectedSkip        alpine                          skip                sha256:234cb88d3020898631af0ccbbcca9a66ae7306ecd30c9720690858c1b007d2a0
expectedFail        expected-not-to-be-registered   fail                <none>
$ docker compose --project-directory local/e2e/compose/fixtures/dry-run-test/pull/ pull  --dry-run --format json
{
    "Services": [
        {
            "Name": "expectedSkip",
            "Image": "alpine",
            "LocalDigests": [
                "sha256:234cb88d3020898631af0ccbbcca9a66ae7306ecd30c9720690858c1b007d2a0"
            ],
            "DistributionDigest": "sha256:234cb88d3020898631af0ccbbcca9a66ae7306ecd30c9720690858c1b007d2a0",
            "Plan": "skip"
        },
        {
            "Name": "expectedFail",
            "Image": "expected-not-to-be-registered",
            "LocalDigests": [],
            "DistributionDigest": "",
            "Plan": "fail"
        },
        {
            "Name": "expectedFetch",
            "Image": "hello-world",
            "LocalDigests": [],
            "DistributionDigest": "sha256:9f6ad537c5132bcce57f7a0a20e317228d382c3cd61edae14650eec68b2b345c",
            "Plan": "fetch"
        }
    ]
}

Related issue
https://github.com/docker/compose-cli/issues/1090

UPDATE:
Example usages' style was broken. fixed.

dry-run

@@ -163,7 +167,19 @@ func (s *composeService) getBuildOptions(project *types.Project, images map[stri

}

func (s *composeService) getLocalImagesDigests(ctx context.Context, project *types.Project) (map[string]string, error) {
func (s *composeService) getLocalImagesIDs(ctx context.Context, project *types.Project) (map[string]string, error) {
Copy link
Author

@satotake satotake Jun 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image ID is different from RepoDigests values. I was confused and renamed it.

@satotake satotake force-pushed the main branch 3 times, most recently from 8d64724 to 8e1c113 Compare June 22, 2021 12:21
@satotake
Copy link
Author

First-time contributors need a maintainer to approve running workflows.

Hi maintainers.
Could you run workflows again?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
local Local context (moby)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant