Skip to content

Using distribution reference pkg (pin image by digest)#28447

Merged
tonistiigi merged 2 commits intomoby:masterfrom
nishanttotla:use-distribution-reference-pkg
Nov 16, 2016
Merged

Using distribution reference pkg (pin image by digest)#28447
tonistiigi merged 2 commits intomoby:masterfrom
nishanttotla:use-distribution-reference-pkg

Conversation

@nishanttotla
Copy link
Contributor

@nishanttotla nishanttotla commented Nov 15, 2016

This PR is a follow up to #28173.

  • The current code that extracts a digest from the service image in docker service create and docker service update uses ParseNamed from the docker/docker/reference package. One problem this causes is that tags are dropped if both tag and digest is provided. For instance ,
docker service create alpine:latest@sha256:1354db23ff5478120c980eca1611a51c9f2b88b61f24283ee8200bf9a54f2e5c top

will create a service, but the service image will be listed as alpine@sha256:1354db23ff5478120c980eca1611a51c9f2b88b61f24283ee8200bf9a54f2e5c instead of alpine:latest@sha256:1354db23ff5478120c980eca1611a51c9f2b88b61f24283ee8200bf9a54f2e5c. Using ParseNamed from docker/distribution/reference package fixes that.

Choose a reason for hiding this comment

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

Why convert descrptr.Digest to a string and back?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@aaronlehmann you're right, this isn't needed. At first I assumed descrptr.Digest was a docker/docker/distribution object.

@aaronlehmann
Copy link

Before anyone asks, yes, it's highly unfortunate that this involves parsing the reference twice. @dmcgowan was working on unifying the two reference packages but this didn't make it into 1.13. I think the solution proposed here is better than the string manipulation we were doing before. As the reference packages converge, this will become cleaner.

Design LGTM

@nishanttotla nishanttotla force-pushed the use-distribution-reference-pkg branch from 60d2284 to e22d3eb Compare November 15, 2016 19:01
@nishanttotla
Copy link
Contributor Author

I don't think the test failure is related. Is this a flaky test from another PR?

@dmcgowan
Copy link
Member

LGTM

To keep with the spirit of the reference package, this function should evolve to take the image in as a reference.Named and return a reference.Canonical. We can do that after resolving the fork.

@nishanttotla
Copy link
Contributor Author

@dmcgowan that would be great (for this and similar functions). Adding a TODO item to keep track of that.

@nishanttotla nishanttotla force-pushed the use-distribution-reference-pkg branch from e22d3eb to dc1b634 Compare November 15, 2016 21:54
@nishanttotla
Copy link
Contributor Author

All tests seem to have passed this time.

cc @aaronlehmann @tonistiigi

@aaronlehmann
Copy link

LGTM

1 similar comment
@tonistiigi
Copy link
Member

LGTM

@tonistiigi tonistiigi merged commit 6697fa8 into moby:master Nov 16, 2016
@GordonTheTurtle GordonTheTurtle added this to the 1.14.0 milestone Nov 16, 2016
@tonistiigi tonistiigi modified the milestones: 1.13.0, 1.14.0 Nov 16, 2016
@nishanttotla nishanttotla deleted the use-distribution-reference-pkg branch November 16, 2016 07:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants