-
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: index referrers for image manifests #41
Conversation
Signed-off-by: wangxiaoxuan273 <[email protected]>
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 with suggestions.
@@ -51,6 +51,10 @@ type Manifest struct { | |||
// configuration. | |||
Layers []distribution.Descriptor `json:"layers"` | |||
|
|||
// Subject specifies the descriptor of another manifest. This value is | |||
// used by the referrers API. | |||
Subject *distribution.Descriptor `json:"subject,omitempty"` |
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.
Do you want to also update the Reference()
function?
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.
added subject
in Reference()
and changed the verifyManifest
function accordingly.
@@ -141,3 +164,20 @@ func (ms *ocischemaManifestHandler) verifyManifest(ctx context.Context, mnfst oc | |||
|
|||
return nil | |||
} | |||
|
|||
// indexReferrers indexes the subject of the given revision in its referrers index store. | |||
func (ms *ocischemaManifestHandler) indexReferrers(ctx context.Context, dm *ocischema.DeserializedManifest, revision digest.Digest) error { |
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.
This is probably OK since oras/distribution
is for testing purpose. It will be better if it is refactored since it duplicated with this function.
Signed-off-by: wangxiaoxuan273 <[email protected]>
Codecov Report
@@ Coverage Diff @@
## main #41 +/- ##
==========================================
- Coverage 57.18% 57.16% -0.02%
==========================================
Files 107 107
Lines 11021 11041 +20
==========================================
+ Hits 6302 6312 +10
- Misses 4011 4019 +8
- Partials 708 710 +2
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
@@ -109,7 +118,7 @@ func (ms *ocischemaManifestHandler) verifyManifest(ctx context.Context, mnfst oc | |||
} | |||
} | |||
|
|||
case v1.MediaTypeImageManifest: | |||
case v1.MediaTypeImageManifest, v1.MediaTypeArtifactManifest, v1.MediaTypeImageIndex, schema2.MediaTypeManifest: |
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 docker manifest list?
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.
Added manifest list and schema1 manifest.
Signed-off-by: wangxiaoxuan273 <[email protected]>
@@ -118,7 +120,7 @@ func (ms *ocischemaManifestHandler) verifyManifest(ctx context.Context, mnfst oc | |||
} | |||
} | |||
|
|||
case v1.MediaTypeImageManifest, v1.MediaTypeArtifactManifest, v1.MediaTypeImageIndex, schema2.MediaTypeManifest: | |||
case v1.MediaTypeImageManifest, v1.MediaTypeArtifactManifest, v1.MediaTypeImageIndex, schema1.MediaTypeManifest, schema2.MediaTypeManifest, manifestlist.MediaTypeManifestList: |
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.
We should remove schema1
as it is deprecated.
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.
removed.
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
Part 8 of issue #21
Part 1 of issue #39