Skip to content

RUN-4630: copy: add platform-based filtering via --multi-arch flag#2874

Merged
mtrmac merged 1 commit into
podman-container-tools:mainfrom
aguidirh:add-platform-based-filtering
May 14, 2026
Merged

RUN-4630: copy: add platform-based filtering via --multi-arch flag#2874
mtrmac merged 1 commit into
podman-container-tools:mainfrom
aguidirh:add-platform-based-filtering

Conversation

@aguidirh

Copy link
Copy Markdown
Contributor

Description

Extends the --multi-arch flag to accept platform specifications, allowing users to copy specific platforms from multi-architecture images without requiring digest hashes.

Changes

  • Extended parseMultiArch() to parse comma-separated platform lists (e.g., linux/amd64,linux/arm64)
  • Updated CLI help text and documentation
  • Added example in man page

Usage

skopeo copy --multi-arch=linux/amd64,linux/arm64 docker://src docker://dst

Implementation Details

  • Leverages the InstancePlatforms field from containers/image
  • Copies ALL instances matching each platform (including compression variants)
  • Creates sparse manifest lists (only specified platforms are copied)
  • Backward compatible with existing --multi-arch options

Testing

  • ✅ Build successful
  • ✅ Validation passed (0 linting issues)
  • ✅ Unit tests passed
  • ✅ Manual testing confirmed: only specified platforms copied

Related

@aguidirh aguidirh changed the title copy: add platform-based filtering via --multi-arch flag RUN-4630: copy: add platform-based filtering via --multi-arch flag May 12, 2026

@mtrmac mtrmac left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks!

A quick first pass. Will SparseManifestListAction be a separate PR?

There’s a question whether skopeo sync should also get this feature. I don’t think that should block this PR, and pointing users towards oc-mirror as an alternative with much more features might actually be better for everyone.

Comment thread cmd/skopeo/copy.go Outdated
Comment thread cmd/skopeo/copy.go Outdated
Comment thread cmd/skopeo/copy.go Outdated
@mtrmac

mtrmac commented May 12, 2026

Copy link
Copy Markdown
Contributor

Also non-blocking: an integration test, maybe copying from knownListImage (or an already-pulled local one in an existing test) would be nice. Or perhaps a single test together with the sparse option.

@mtrmac mtrmac left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

A full review now.

Comment thread cmd/skopeo/copy.go Outdated
Comment thread cmd/skopeo/copy.go Outdated
Comment thread docs/skopeo-copy.1.md
Comment thread docs/skopeo-copy.1.md Outdated
Comment thread cmd/skopeo/copy.go
@aguidirh

Copy link
Copy Markdown
Contributor Author

Also non-blocking: an integration test, maybe copying from knownListImage (or an already-pulled local one in an existing test) would be nice. Or perhaps a single test together with the sparse option.

The suggestion above is implemented on fb229f08.

@aguidirh

Copy link
Copy Markdown
Contributor Author

Thanks!

A quick first pass. Will SparseManifestListAction be a separate PR?

Yes, I will open a separate PR for SparseManifestListAction .

There’s a question whether skopeo sync should also get this feature. I don’t think that should block this PR, and pointing users towards oc-mirror as an alternative with much more features might actually be better for everyone.

If there are advantages of doing that also in the sync command, I'm more than happy to implement it. What is your opinion about having it also in the skopeo sync ?

Comment thread cmd/skopeo/copy_test.go Outdated
Comment thread integration/copy_test.go Outdated
@mtrmac

mtrmac commented May 12, 2026

Copy link
Copy Markdown
Contributor

There’s a question whether skopeo sync should also get this feature. I don’t think that should block this PR, and pointing users towards oc-mirror as an alternative with much more features might actually be better for everyone.

If there are advantages of doing that also in the sync command, I'm more than happy to implement it. What is your opinion about having it also in the skopeo sync ?

I think keeping it copy-only is perfectly sufficient, and, on balance, it might be better not to add it to sync. We can add that at any time later if a user asks for it.

@mtrmac mtrmac left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks! LGTM, please squash the commits.

Extends the --multi-arch flag to accept platform specifications,
allowing users to copy specific platforms from multi-architecture
images without requiring digest hashes.

Users can now specify platforms using OS/Architecture pairs:
  skopeo copy --multi-arch=linux/amd64,linux/arm64 docker://src docker://dst

This feature:
- Parses comma-separated platform specifications (e.g., linux/amd64,linux/arm64)
- Copies ALL instances matching each specified platform (including all
  compression variants and other variations)
- Works alongside existing --multi-arch options (system, all, index-only)
- Leverages the InstancePlatforms field added in containers/image

The implementation follows the design from containers/image#1938 and
podman-container-tools/container-libs#656, providing a more user-friendly alternative
to specifying digest hashes via the Instances field.

Signed-off-by: Alex Guidi <aguidi@redhat.com>
@aguidirh aguidirh force-pushed the add-platform-based-filtering branch from c1fd287 to 7a6acb1 Compare May 13, 2026 18:22
@aguidirh

Copy link
Copy Markdown
Contributor Author

@mtrmac commits squashed.

Is there anything else to do in this PR before merging?

@mtrmac

mtrmac commented May 14, 2026

Copy link
Copy Markdown
Contributor

That‘s it, thanks!

@mtrmac mtrmac merged commit e731040 into podman-container-tools:main May 14, 2026
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants