-
Notifications
You must be signed in to change notification settings - Fork 201
feat: oras manifest index: artifactType for index and child manifest descriptors #1700
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
feat: oras manifest index: artifactType for index and child manifest descriptors #1700
Conversation
(I'm going to leave this as a draft for now because #1696 is not finalized yet.) |
eb39bf0
to
88237eb
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1700 +/- ##
==========================================
+ Coverage 85.20% 85.24% +0.03%
==========================================
Files 129 129
Lines 5780 5815 +35
==========================================
+ Hits 4925 4957 +32
- Misses 609 611 +2
- Partials 246 247 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
6329d81
to
b84868b
Compare
The "index create" and "index update" subcommands now accept --artifact-type options to set or change the "artifactType" property of the index manifest. Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
For each manifest in the generated index manifest that is of a recognized media type and has an artifactType value, we'll copy that value into the associated descriptor so that software consuming the index can optionally ignore or reject descriptors of the wrong artifactType without having to retrieve the full manifest first. The behavior does not change for manifests of any other media type or those which do not have an artifactType property. Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
b84868b
to
a753d5f
Compare
Previously the --artifact-type option would accept any non-empty string and copy it into the artifactType property of the index. Now we'll require that it matches the regular expression pattern given in the OCI image spec, so that we can avoid creating manifests with syntactically-invalid artifact type values. Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adds support for specifying and propagating artifactType
in OCI index creation and updates, including validation and E2E/unit tests.
- Introduce
--artifact-type
flag tooras manifest index create
andupdate
- Validate media type syntax and apply it to the created/updated index and child descriptors
- Expand E2E and unit tests to cover
artifactType
behavior in both registry and OCI layout modes
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
test/e2e/suite/command/manifest_index.go | Added E2E tests for artifactType propagation, creation, update, removal, and validation |
cmd/oras/root/manifest/index/update.go | Registered --artifact-type flag, added validation and update logic for index artifact type |
cmd/oras/root/manifest/index/create_test.go | New unit tests for enrichDescriptor and validateMediaType |
cmd/oras/root/manifest/index/create.go | Registered --artifact-type flag, added validation and initialization of index artifact type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
What this PR does / why we need it:
This implements the new behavior proposed in #1696.
I am contributing this change on behalf of the OpenTofu project.
Which issue(s) this PR fixes:
Fixes #1670
Please check the following list: