Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: force config media type when setting platform #1519

Merged
merged 5 commits into from
Nov 3, 2024

Conversation

qweeah
Copy link
Contributor

@qweeah qweeah commented Oct 29, 2024

What this PR does / why we need it:

When selecting a platform, oras-go only allows config type to be application/vnd.oci.image.config.v1+json. See https://github.com/oras-project/oras-go/blob/v2.5.0/internal/platform/platform.go#L110.

This PR enforces above design with 2 changes:

  1. config.mediaType is set to application/vnd.oci.image.config.v1+json when baking platform into the config blob;
  2. The usage of oras push --artifact-type xxx -artifact-platform xxx --image-spec v1.0 ... is banned.

Without this PR, oras push might generate artifacts that cannot be consumed by oras pull --platform, see #1517 (comment)

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #1517

Please check the following list:

  • Does the affected code have corresponding tests, e.g. unit test, E2E test?
  • Does this change require a documentation update?
  • Does this introduce breaking changes that would require an announcement or bumping the major version?
  • Do all new files have an appropriate license header?

Signed-off-by: Billy Zha <[email protected]>
Copy link

codecov bot commented Oct 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.87%. Comparing base (9a83394) to head (7ac6dad).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1519   +/-   ##
=======================================
  Coverage   83.86%   83.87%           
=======================================
  Files         118      118           
  Lines        5164     5166    +2     
=======================================
+ Hits         4331     4333    +2     
  Misses        592      592           
  Partials      241      241           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

cmd/oras/root/push.go Outdated Show resolved Hide resolved
Copy link
Member

@TerryHowe TerryHowe left a comment

Choose a reason for hiding this comment

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

/lgtm

@TerryHowe TerryHowe merged commit 8f0f0cd into oras-project:main Nov 3, 2024
5 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.

oras push --artifact-platform is not compatible with oras pull --platform and similar commands
3 participants