-
Notifications
You must be signed in to change notification settings - Fork 5
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!: implement artifact manifest type #29
feat!: implement artifact manifest type #29
Conversation
Signed-off-by: wangxiaoxuan273 <[email protected]>
Codecov Report
@@ Coverage Diff @@
## main #29 +/- ##
==========================================
- Coverage 57.18% 57.15% -0.03%
==========================================
Files 105 106 +1
Lines 10842 10914 +72
==========================================
+ Hits 6200 6238 +38
- Misses 3954 3981 +27
- Partials 688 695 +7
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
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.
How about create a new package named manifest/ociartifact
since each type of manifest should have its own package? See https://github.com/oras-project/distribution/tree/main/manifest
Done. |
Signed-off-by: wangxiaoxuan273 <[email protected]>
Signed-off-by: wangxiaoxuan273 <[email protected]>
} | ||
|
||
// ArtifactManifest defines an ocischema artifact manifest. | ||
type ArtifactManifest struct { |
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.
Curious why don't we use v1.Artifact
?
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.
Because this struct needs to satisfy the manifest interface, also there are some compatibility issues as v1.Artifact uses oci.Descriptor but distribution uses distribution.Descriptor.
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.
ok, fair. Then there're a few disparities between the 2 structs:
- artifactType is a required field, so we don't need omitempty
- Better use
*distribution.Descriptor
for the optional subject
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.
Ok, I read the latest oci artifact manifest spec, artifactType is actually SHOULD.
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.
Changed subject to pointer after offline discussion. This gives func (m Manifest) References()
a better design since it's much easier to decide whether it is nil. Thanks Wei!
Signed-off-by: wangxiaoxuan273 <[email protected]>
I think a builder struct (present for ocischema manifest) will be needed for artifact manifest, so that we can enforce some rules on artifact manifest creation. I'll add it in future when necessary, for now I'll just create artifact manifest by hand. |
Signed-off-by: wangxiaoxuan273 <[email protected]>
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
Implemented ArtifactManifest and related structs and functions. Unit tests included.
Part 2 of #21
Signed-off-by: wangxiaoxuan273 [email protected]