build: omit empty :tag / @digest segments when rebuilding oci-layout ref#3809
Closed
SAY-5 wants to merge 1 commit intodocker:masterfrom
Closed
build: omit empty :tag / @digest segments when rebuilding oci-layout ref#3809SAY-5 wants to merge 1 commit intodocker:masterfrom
SAY-5 wants to merge 1 commit intodocker:masterfrom
Conversation
resolveBuildContext concatenated the parsed oci-layout ref back into a FrontendAttr via 'oci-layout://' + storeName + ':' + tag + '@' + dig unconditionally. When the user passed a digest-only context (oci-layout:///path@sha256:...), the Parse result left tag empty, so the concat produced 'oci-layout://<storeID>:@sha256:...' which fails the frontend's reference parser with 'invalid reference format'. This regressed in v0.33.0 along with the oci-layout parsing refactor (docker#3793). Build the attr piecewise, only appending ':tag' when tag is non-empty and '@digest' when digest is non-empty. Tag-only and tag+digest refs are unchanged. Fixes docker#3793 Signed-off-by: SAY-5 <SAY-5@users.noreply.github.com>
Member
|
Thanks for working on this and for taking the time to put together. We ended up moving forward with a repo-native follow-up in #3811 and #3812 so we can land the change in the shape we want, with the test coverage and integration coverage aligned with the rest of the codebase. Because of that, I'm going to close this PR so the work stays consolidated in one place. We appreciate the report and the attempted fix. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #3793.
resolveBuildContextconcatenated the parsed oci-layout ref back into a FrontendAttr via:When the user passed a digest-only context (
oci-layout:///path@sha256:...),ocilayout.Parsereturnedtag == "", so the concat producedoci-layout://<storeID>:@sha256:.... The downstream frontend's reference parser rejects the empty:segment withinvalid reference format. The regression arrived in v0.33.0 alongside the oci-layout parse refactor.Fix
Build the attr piecewise: only append
":" + tagwhen tag is non-empty and"@" + digwhen digest is non-empty. Tag-only (:1.3) and tag+digest refs retain their existing serialization.Test plan
go build ./build/...cleango vet ./build/...cleango test ./build/... ./util/ocilayout/...green (existingTestParsealready covers the digest-only Parse case; this fix lives in the re-serialization step, which has no unit-level harness — the frontend contract is what enforces it, and the issue reporter's repro now goes through).docker buildx build --build-context proxy=oci-layout:///some/layout@sha256:<digest> .no longer errors withinvalid reference format.