-
Notifications
You must be signed in to change notification settings - Fork 1.3k
docker: add support for org.opencontainers.image.version and org.opencontainers.image.revision
#13855
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
base: main
Are you sure you want to change the base?
Conversation
aa3a074 to
37b1bcc
Compare
37b1bcc to
9a359c5
Compare
org.opencontainers.image.version and org.opencontainers.image.revision
org.opencontainers.image.version and org.opencontainers.image.revisiondocker: add support for org.opencontainers.image.version and org.opencontainers.image.revision
939b164 to
591a979
Compare
| requirement: nil, | ||
| groups: [], | ||
| source: { registry: "ghcr.io", | ||
| digest: "sha256:389a5a9a5457ed237b05d623ddc31a42fa97811051dcd02d7ca4ad46bd3edd3e" } |
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.
The only change I applied to this test is to remove the sha256 prefix as the spec was misleading. Our source parser drops sha256 currently
f66c0ff to
ccd2792
Compare
|
|
||
| Dependabot.logger.info "Building source with branch '#{image_version}' and commit '#{revision}'" | ||
|
|
||
| Dependabot::Source.new( |
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.
I am not sure if there is any easier way to do this other than to change how Source.from_url works which may cause undesired side-effects. I am open for feedback/ideas 👀
3d2cc65 to
a911de9
Compare
a911de9 to
ffee40b
Compare
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
This PR extends Docker metadata extraction to support digest-only image references by utilizing OCI annotations org.opencontainers.image.version and org.opencontainers.image.revision. When an image is referenced by digest without a tag, the implementation now attempts to extract version information from these OCI metadata fields to construct a Dependabot::Source object with branch and commit information.
Key changes:
- Added logic to handle digest-only image references using OCI metadata annotations
- Extracted
image_detailsmethod to centralize Docker image inspection logic - Implemented
build_source_from_image_versionto construct Source objects from OCI version/revision labels
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
docker/lib/dependabot/docker/metadata_finder.rb |
Refactored look_up_source to support digest-only images; extracted image_details method for image inspection; added build_source_from_image_version to build Source from OCI annotations |
docker/spec/dependabot/docker/metadata_finder_spec.rb |
Added test coverage for digest-only images with OCI version annotations, digest-only images without proper annotations, and fixed digest format consistency (removed "sha256:" prefix) |
|
@yeikel , There are copilot suggestions. Will it be possible if you go over them? You can either apply the suggested fix or resolve with a feedback. |
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
Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.
0a9feab to
37785e8
Compare
@kbukum1 I applied the feedback for the latest round of Copilot's feedback Thanks! |
9522ba1 to
11df38d
Compare
kbukum1
left a comment
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
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
489c09c to
dd981ab
Compare
|
@kbukum1 I applied the latest round of feedback from copilot which dismissed your review again. Could you please take a look again? Also, the only pending comment is #13855 (comment) which I don't really agree with unless you think I should do that. I personally feel that exposing the Thanks |
384d8d7 to
176fc03
Compare
2931d1a to
5e5e7d1
Compare
5e5e7d1 to
c4c6d29
Compare
…sion and org.opencontainers.image.revision Extends metadata extraction to handle digest-only image references, where no tag is present. This new logic will run when one of the following additional OCI metadata fields are present along with the digest: - `org.opencontainers.image.version`: Packaged software version. This can sometimes be a tag - `org.opencontainers.image.revision`: Source control revision identifier for the packaged software
c4c6d29 to
2eeb77c
Compare
What are you trying to accomplish?
Extends metadata extraction to handle digest-only image references, where no tag is present.
This new logic will run when one of the following additional OCI metadata fields are present along with the digest:
From the OCI docs:
org.opencontainers.image.version: Packaged software version. This can sometimes be a tagorg.opencontainers.image.revision: Source control revision identifier for the packaged softwareHow will you know you've accomplished your goal?
Checklist