Skip to content

Conversation

@yeikel
Copy link
Contributor

@yeikel yeikel commented Dec 23, 2025

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 tag
  • org.opencontainers.image.revision: Source control revision identifier for the packaged software

How will you know you've accomplished your goal?

Checklist

  • I have run the complete test suite to ensure all tests and linters pass.
  • I have thoroughly tested my code changes to ensure they work as expected, including adding additional tests for new functionality.
  • I have written clear and descriptive commit messages.
  • I have provided a detailed description of the changes in the pull request, including the problem it addresses, how it fixes the problem, and any relevant details about the implementation.
  • I have ensured that the code is well-documented and easy to understand.

@yeikel yeikel force-pushed the feat/image-version-revision branch from aa3a074 to 37b1bcc Compare December 23, 2025 19:09
@github-actions github-actions bot added the L: docker Docker containers label Dec 23, 2025
@yeikel yeikel force-pushed the feat/image-version-revision branch from 37b1bcc to 9a359c5 Compare December 23, 2025 19:10
@yeikel yeikel changed the title docker: add metadata finding support for org.opencontainers.image.version and org.opencontainers.image.revision docker: add support for org.opencontainers.image.version and org.opencontainers.image.revision Dec 23, 2025
@yeikel yeikel changed the title docker: add support for org.opencontainers.image.version and org.opencontainers.image.revision docker: add support for org.opencontainers.image.version and org.opencontainers.image.revision Dec 23, 2025
@yeikel yeikel force-pushed the feat/image-version-revision branch 6 times, most recently from 939b164 to 591a979 Compare December 23, 2025 21:32
requirement: nil,
groups: [],
source: { registry: "ghcr.io",
digest: "sha256:389a5a9a5457ed237b05d623ddc31a42fa97811051dcd02d7ca4ad46bd3edd3e" }
Copy link
Contributor Author

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

@yeikel yeikel force-pushed the feat/image-version-revision branch 3 times, most recently from f66c0ff to ccd2792 Compare December 23, 2025 22:08

Dependabot.logger.info "Building source with branch '#{image_version}' and commit '#{revision}'"

Dependabot::Source.new(
Copy link
Contributor Author

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 👀

@yeikel yeikel closed this Dec 23, 2025
@yeikel yeikel reopened this Dec 23, 2025
@yeikel yeikel force-pushed the feat/image-version-revision branch 3 times, most recently from 3d2cc65 to a911de9 Compare December 23, 2025 22:17
@yeikel yeikel marked this pull request as ready for review December 23, 2025 22:17
@yeikel yeikel requested a review from a team as a code owner December 23, 2025 22:17
@yeikel yeikel force-pushed the feat/image-version-revision branch from a911de9 to ffee40b Compare December 31, 2025 14:50
@kbukum1 kbukum1 requested a review from Copilot December 31, 2025 15:07
Copy link
Contributor

Copilot AI left a 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_details method to centralize Docker image inspection logic
  • Implemented build_source_from_image_version to 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)

@kbukum1
Copy link
Contributor

kbukum1 commented Dec 31, 2025

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

@kbukum1 kbukum1 self-assigned this Dec 31, 2025
Copy link
Contributor

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

@yeikel yeikel force-pushed the feat/image-version-revision branch 3 times, most recently from 0a9feab to 37785e8 Compare December 31, 2025 16:10
@yeikel
Copy link
Contributor Author

yeikel commented Dec 31, 2025

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

Thank you @kbukum1. I believe that I applied the feedback and/or documented some of the decisions that Copilot questioned/were not clear

@kbukum1 I applied the feedback for the latest round of Copilot's feedback

Thanks!

@yeikel yeikel force-pushed the feat/image-version-revision branch 5 times, most recently from 9522ba1 to 11df38d Compare January 5, 2026 23:07
@kbukum1 kbukum1 requested a review from Copilot January 6, 2026 15:42
kbukum1
kbukum1 previously approved these changes Jan 6, 2026
Copy link
Contributor

@kbukum1 kbukum1 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

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

@yeikel yeikel force-pushed the feat/image-version-revision branch 2 times, most recently from 489c09c to dd981ab Compare January 6, 2026 16:05
@yeikel
Copy link
Contributor Author

yeikel commented Jan 6, 2026

@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 source object/properties just for this test is an overkill but I am open to do it

Thanks

@yeikel yeikel force-pushed the feat/image-version-revision branch 3 times, most recently from 384d8d7 to 176fc03 Compare January 12, 2026 17:36
@yeikel yeikel force-pushed the feat/image-version-revision branch 4 times, most recently from 2931d1a to 5e5e7d1 Compare January 20, 2026 18:25
@yeikel yeikel force-pushed the feat/image-version-revision branch from 5e5e7d1 to c4c6d29 Compare January 22, 2026 01:44
…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
@yeikel yeikel force-pushed the feat/image-version-revision branch from c4c6d29 to 2eeb77c Compare January 26, 2026 23:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

L: docker Docker containers

Projects

Status: On Hold

Development

Successfully merging this pull request may close these issues.

2 participants