Repository navigation
feat(cp): support multiple platforms - #2191
Conversation
Signed-off-by: Shantanav Mukherjee <[email protected]>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2191 +/- ##
==========================================
+ Coverage 87.78% 88.14% +0.36%
==========================================
Files 139 139
Lines 5714 6015 +301
==========================================
+ Hits 5016 5302 +286
- Misses 417 425 +8
- Partials 281 288 +7 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
And the codecov I'm afraid. |
|
I'll address all these changes and fix the reason codecov is failing |
|
Addressed the maintainer feedback in commit c52e3ca:
Focused tests, the full Go suite, race tests, vet, encoding validation, and the E2E command-package compile all pass. The refreshed GitHub checks are running now. Please take another look when you have time. |
Signed-off-by: Shantanav Mukherjee <[email protected]>
Signed-off-by: Shantanav Mukherjee <[email protected]>
c78fe6e to
c89e736
Compare
|
Updated the branch to c89e736 with signed-off history, and the DCO check is now passing. The maintainer fixes and added coverage are preserved in this head. Please review the latest commit when convenient; the remaining GitHub checks are still running. |
TerryHowe
left a comment
There was a problem hiding this comment.
Thanks for the quick turnaround on the last round — the Unwrap hook, the conditional ReferrerLister wrapper, the raw-JSON index rewrite and the parse-time de-duplication all landed as discussed, and I've resolved those threads.
Re-reviewing the result at c89e736, the attestation carry-over added in c52e3ca interacts badly with the preserve-the-root fast path, so the digest guarantee in the PR description doesn't hold for buildx images. That plus a second digest issue are below, along with a handful of smaller things. I built the branch and ran the unit suite locally (green) before writing this.
The -r referrer thread stays open — the warning landed, but the e2e point in it hasn't been picked up yet.
Address the maintainer review and retain regression coverage. Signed-off-by: Shantanav Mukherjee <[email protected]>
Refactor tests to use logrus for logging and update function signatures to include additional parameters.Add regression coverage for filtered indexes and recursive child referrers. Signed-off-by: Shantanav Mukherjee <[email protected]>
Refactor ORAS command to match keywords for Linux AMD64 referrer. Signed-off-by: Shantanav Mukherjee <[email protected]>
|
Thanks for the detailed review. I’ve pushed the fixes through |
Signed-off-by: Shantanav Mukherjee <[email protected]>
Query the selected linux/amd64 manifest digest so discovery checks the child-level referrer copied by recursive multi-platform cp. Signed-off-by: Shantanav Mukherjee <[email protected]>
Signed-off-by: Shantanav Mukherjee <[email protected]>
Signed-off-by: Shantanav Mukherjee <[email protected]>
|
Added regression coverage in |
|
Update: CI is now green on |
TerryHowe
left a comment
There was a problem hiding this comment.
Re-reviewed at 979812c. Everything from the previous two rounds landed and I verified each one empirically against hand-built OCI layouts: raw-JSON field and key-order preservation, buildx attestation carry-over, digest preservation on full selection, rootInSource=false, the stderr warning, Unwrap, the oerrors.Error on unmatched platforms, and parse-time de-duplication. I also built the branch and ran the unit suite, go vet and golangci-lint — all green.
One new correctness bug, with a ready-to-apply fix in the suggestions below: platform filtering matches index entries by descriptor equality, so an index that lists one manifest under several platforms copies platforms the user did not select. The suggestions are one patch split across hunks — applying all of them together compiles; applying a subset will not.
Two smaller things that are not blocking:
-
cp.go:207—fmt.Errorf("failed to resolve %s: %w", opts.From.Reference, err)drops the source attribution every othercppath gives, and prints the parsed reference rather than what the user typed. Same layout, same missing tag, only the platform count differs:$ oras cp … src:nope dst:v1 --platform linux/amd64 # today Error from source oci-layout for "src:nope": not found $ oras cp … src:nope dst:v1 --platform linux/amd64,linux/arm64 # this PR Error: failed to resolve nope: not foundoras.Copyreturns an*oras.CopyErrorwithOrigin: Source, which is whatBinaryTarget.ModifyErrorkeys on for that prefix. Returningerrunwrapped, or wrapping in an*oras.CopyErrorwithOrigin: oras.CopyErrorOriginSource, restores it. (doCopy's-rbranch has the same wart today, but that one is pre-existing and-ris Preview; this regresses the default path.) -
cp.go:259—availablePlatformsincludes buildx attestation entries, so the recommendation advertises pseudo-platforms, once per attestation:Error: unmatched platforms: [linux/s390x] available platforms in index: [linux/amd64, linux/arm64, linux/arm/v7, unknown/unknown, unknown/unknown]Skipping entries carrying
dockerReferenceDigestAnnotation, and de-duplicating, keeps the list to things worth typing.
The raw-JSON rewrite is holding up well — I confirmed source key order, platform.features, descriptor urls and an unknown top-level x-vendor-extension all survive byte-identically into the filtered index. Nice work on that one.
Signed-off-by: Shantanav Mukherjee <[email protected]>
TerryHowe
left a comment
There was a problem hiding this comment.
Re-reviewed at 12a3028. Position-based filtering, the de-duplicated recommendation list and the *oras.CopyError on resolve all landed — I built the branch, ran the unit suites (green) and re-verified each fix empirically against hand-built OCI layouts, including kept = [0 2] for an index that lists one manifest under two variants.
Requesting changes for one leftover from the last round (cp.go:246, a one-line fix), plus a few smaller notes inline. Nothing here is a correctness bug in the filtering itself; the recursive-subset behavior is exactly as documented — with referrers on the amd64 child, the s390x child and the index, cp -r --platform linux/amd64,linux/arm64 copied the amd64 referrer and dropped the other two.
TerryHowe
left a comment
There was a problem hiding this comment.
Re-reviewed at 12a3028. All three points from the last round landed and I verified each empirically against hand-built OCI layouts: positional filtering now drops the unselected entry when one manifest digest is listed under two platforms, the source-origin prefix is back on the resolve error, and the recommendation no longer advertises attestation pseudo-platforms. The raw-JSON rewrite continues to reproduce the source digest byte-for-byte on full selection.
Three things below. The e2e gap on -r and the always-on warning are two halves of the same problem: referrer loss on a subset copy is real, and right now it is neither tested nor honestly reported.
Unit suite, go vet and a build are green on this head.
Signed-off-by: Shantanav Mukherjee <[email protected]>
Signed-off-by: Shantanav Mukherjee <[email protected]>
Signed-off-by: Shantanav Mukherjee <[email protected]>
|
Thanks! |
What this PR does / why we need it:
Add multi-platform selection to
oras cpby accepting repeated or comma-separated--platformvalues. Single-platform behavior stays unchanged. Multiple selections require an OCI image index or Docker manifest list, preserve the original digest when every platform is selected, and create a filtered index for subsets. Variant and OS version matching is exact when specified, while omitted values act as wildcards. Recursive copies retain selected child referrers.Which issue(s) this PR fixes:
Fixes #2163
Please check the following list:
Testing:
go test ./...go test -race ./...go vet ./...make check-encodingcd test/e2e && go test -run '^$' ./suite/commandgit diff --check