Using distribution reference pkg (pin image by digest)#28447
Using distribution reference pkg (pin image by digest)#28447tonistiigi merged 2 commits intomoby:masterfrom
Conversation
Signed-off-by: Nishant Totla <[email protected]>
daemon/cluster/cluster.go
Outdated
There was a problem hiding this comment.
Why convert descrptr.Digest to a string and back?
There was a problem hiding this comment.
@aaronlehmann you're right, this isn't needed. At first I assumed descrptr.Digest was a docker/docker/distribution object.
|
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 |
60d2284 to
e22d3eb
Compare
|
I don't think the test failure is related. Is this a flaky test from another PR? |
|
LGTM To keep with the spirit of the reference package, this function should evolve to take the image in as a |
|
@dmcgowan that would be great (for this and similar functions). Adding a TODO item to keep track of that. |
Signed-off-by: Nishant Totla <[email protected]>
e22d3eb to
dc1b634
Compare
|
All tests seem to have passed this time. |
|
LGTM |
1 similar comment
|
LGTM |
This PR is a follow up to #28173.
docker service createanddocker service updateusesParseNamedfrom thedocker/docker/referencepackage. One problem this causes is that tags are dropped if both tag and digest is provided. For instance ,will create a service, but the service image will be listed as
alpine@sha256:1354db23ff5478120c980eca1611a51c9f2b88b61f24283ee8200bf9a54f2e5cinstead ofalpine:latest@sha256:1354db23ff5478120c980eca1611a51c9f2b88b61f24283ee8200bf9a54f2e5c. UsingParseNamedfromdocker/distribution/referencepackage fixes that.The second problem this PR fixes is that it gets rid of string manipulation, and uses the
WithDigestfunction fromdocker/distribution/referenceto cleanly construct the image string.This PR also updates the vendored version for
docker/distributionto include Adding utility functions - IsNameOnly and EnsureTagged distribution/distribution#2062 and digest: Preserve tag and digest in With* functions distribution/distribution#2044