Skip to content

c8d/pull: Handle pull all tags (2nd approach)#46618

Merged
thaJeztah merged 2 commits intomoby:masterfrom
vvoland:c8d-pull-all-tags-2
Oct 31, 2023
Merged

c8d/pull: Handle pull all tags (2nd approach)#46618
thaJeztah merged 2 commits intomoby:masterfrom
vvoland:c8d-pull-all-tags-2

Conversation

@vvoland
Copy link
Contributor

@vvoland vvoland commented Oct 11, 2023

distribution: Add Tags

Add a function to return tags for the given repository reference. This
is needed to implement the pull -a (pull all tags) for containerd
which doesn't directly use distribution, but we need to somehow make an
API call to the registry to obtain the available tags.

c8d/pull: Handle pull all tags

Use the distribution code to query the remote repository for tags and
pull them sequentially just like the non-c8d pull.

- How to verify it

$ docker pull -a docker/doodle
-Error response from daemon: failed to resolve reference "docker.io/docker/doodle": object required
+birthday: Pulling from docker/doodle
+ecaf003f35ec: Download complete
+Digest: sha256:4a203cbea73f32a4885f8d9ee05233246445aa95dd4362887058ec663a7b8088
+Status: Downloaded newer image for docker/doodle:birthday
+birthday2019: Pulling from docker/doodle
+Digest: sha256:4a203cbea73f32a4885f8d9ee05233246445aa95dd4362887058ec663a7b8088
+Status: Downloaded newer image for docker/doodle:birthday2019
(...)
+summer: Pulling from docker/doodle
+6fe738df11e6: Download complete
+Digest: sha256:f7fdfd4a030d16a619f32f183307c9f60ddd9206dc92b1c3b1e1c2f1450567fc
+Status: Downloaded newer image for docker/doodle:summer
+summer2019: Pulling from docker/doodle
+Digest: sha256:f7fdfd4a030d16a619f32f183307c9f60ddd9206dc92b1c3b1e1c2f1450567fc
+Status: Downloaded newer image for docker/doodle:summer2019
+docker.io/docker/doodle

- Description for the changelog

- containerd image store: Implement pulling all tags (`docker pull -a`)

- A picture of a cute animal (not mandatory but encouraged)

@vvoland vvoland added area/distribution Image Distribution status/2-code-review area/images Image Distribution containerd-integration Issues and PRs related to containerd integration labels Oct 11, 2023
@vvoland vvoland added this to the 25.0.0 milestone Oct 11, 2023
Add a function to return tags for the given repository reference. This
is needed to implement the `pull -a` (pull all tags) for containerd
which doesn't directly use distribution, but we need to somehow make an
API call to the registry to obtain the available tags.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Use the distribution code to query the remote repository for tags and
pull them sequentially just like the non-c8d pull.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
@vvoland vvoland force-pushed the c8d-pull-all-tags-2 branch from 133df0a to d9b5445 Compare October 16, 2023 12:19
@vvoland vvoland self-assigned this Oct 26, 2023
Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines +33 to +34
// Tags returns available tags for the given image in the remote repository.
func Tags(ctx context.Context, ref reference.Named, config *Config) ([]string, error) {
Copy link
Member

Choose a reason for hiding this comment

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

Was looking if we could move this to an internal package, but that complicates things as well. Perhaps an alternative could be to call it out in the GoDoc as "for internal use", but we can do so in a follow-up if we think that's a good idea.

return i.pullTag(ctx, tagged, platform, metaHeaders, authConfig, out)
}

tags, err := distribution.Tags(ctx, baseRef, &distribution.Config{
Copy link
Member

Choose a reason for hiding this comment

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

For a future iteration, we should consider moving this logic to the API (and either pass a list of tags, or a full list of references to pull)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/distribution Image Distribution area/images Image Distribution containerd-integration Issues and PRs related to containerd integration status/2-code-review

Projects

Development

Successfully merging this pull request may close these issues.

3 participants