Skip to content

fix: allow setting org.opencontainers.image.title in annotation file#1872

Merged
shizhMSFT merged 1 commit into
oras-project:mainfrom
rafaelgieschke:image-title
Oct 20, 2025
Merged

fix: allow setting org.opencontainers.image.title in annotation file#1872
shizhMSFT merged 1 commit into
oras-project:mainfrom
rafaelgieschke:image-title

Conversation

@rafaelgieschke

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

Currently, trying to set "org.opencontainers.image.title" in an annotation file will error:

$ echo $RANDOM > file; echo '{"file":{"org.opencontainers.image.title":"file2"}}' > annotations.json; oras push --annotation-file annotations.json registry.example/test/test file

Error response from registry: file2: application/vnd.oci.image.layer.v1.tar: not found

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 #

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?

@codecov

codecov Bot commented Sep 29, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.36%. Comparing base (4f727a7) to head (8d74fad).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1872      +/-   ##
==========================================
+ Coverage   85.32%   85.36%   +0.03%     
==========================================
  Files         143      143              
  Lines        6739     6743       +4     
==========================================
+ Hits         5750     5756       +6     
+ Misses        703      701       -2     
  Partials      286      286              

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@shizhMSFT shizhMSFT 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.

It looks valid. Wait other maintainers to review.

@shizhMSFT

Copy link
Copy Markdown
Contributor

@rafaelgieschke Thanks for your contribution! Could you provide more tests for better coverage?

@TerryHowe TerryHowe requested a review from Copilot September 29, 2025 14:21

Copilot AI 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.

Pull Request Overview

This PR fixes an issue where setting the "org.opencontainers.image.title" annotation in an annotation file would cause an error. The fix allows users to override file names using the OCI annotation title field.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@TerryHowe TerryHowe left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/lgtm

@FeynmanZhou

Copy link
Copy Markdown
Member

Are we good to merge this PR?

@rafaelgieschke

Copy link
Copy Markdown
Contributor Author

Are we good to merge this PR?

As suggested in #1872 (comment), I just added some test. It should give coverage of the changed lines but I am not sure if this is the most elegant test for this change.

@Wwwsylvia

Wwwsylvia commented Oct 15, 2025

Copy link
Copy Markdown
Member

The codecov is behaving a bit strangely. 🤨 Maybe we can bypass it for this time?
image

Currently, trying to set "org.opencontainers.image.title" in an annotation
file will error:

$ echo $RANDOM > file; echo '{"file":{"org.opencontainers.image.title":"file2"}}' > annotations.json; oras push --annotation-file annotations.json registry.example/test/test file

Error response from registry: file2: application/vnd.oci.image.layer.v1.tar: not found

Signed-off-by: Rafael Gieschke <rafael@gieschke.de>
@shizhMSFT shizhMSFT merged commit 7cbdb36 into oras-project:main Oct 20, 2025
8 checks passed
TerryHowe pushed a commit to TerryHowe/oras that referenced this pull request Mar 4, 2026
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.

6 participants