c8d/image: Allow truncated id to have sha256: prefix#46435
c8d/image: Allow truncated id to have sha256: prefix#46435thaJeztah merged 1 commit intomoby:masterfrom
Conversation
Fixes TestInspectByPrefix when running with c8d snapshotters enabled. Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
|
https://github.com/moby/moby/actions/runs/6121551710/job/16615613531?pr=45232 |
|
|
||
| // If the identifier could be a short ID, attempt to match | ||
| if truncatedID.MatchString(refOrID) { | ||
| idWithoutAlgo := strings.TrimPrefix(refOrID, "sha256:") |
There was a problem hiding this comment.
Do you know if the non-containerd variant actually allows ID prefixes here? The stringed. IsShortID function only accepts short (fixed length, 12-characters) ID;
Lines 18 to 31 in 152036f
(Also slightly wondering if trimming the algorithm before matching it would be an alternative (I haven't benchmarked the regex though))
There was a problem hiding this comment.
Thanks! LOL, so much for consistency 😂
wouldn't surprise me if the test was written based on "it works" and not "what was meant to work"
There was a problem hiding this comment.
Did a quick check; this was the PR adding that test;
- Vendor distribution and fix inspect by sha256 prefix #18409
- Fix image deletion conflicts with search #18443
- related to Validate digest length on parsing distribution/distribution#1231
Funny thing is that that last one seems to be changing things to use longer digests in tests (and removing the short ones).
Oh, wait, but that test does use 12 characters (originally it took 10, but updated in the second PR above)? Did it overlook the sha256: prefix in that length 🤔 ?
moby/integration-cli/docker_cli_inspect_test.go
Lines 308 to 317 in 6dcefa3
thaJeztah
left a comment
There was a problem hiding this comment.
LGTM
we should probably double-check if the test was meant to be supporting this (maybe, maybe not) 😂
Fixes TestInspectByPrefix when running with c8d snapshotters enabled.
- What I did
- How I did it
- How to verify it
$ make TEST_IGNORE_CGROUP_CHECK=1 \ DOCKER_GRAPHDRIVER=overlayfs TEST_INTEGRATION_USE_SNAPSHOTTER=1 \ TEST_FILTER='TestInspectByPrefix' \ test-integration- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)