Skip to content
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

fix: dynamic plugin should support pulling image with digest #1280

Merged
merged 9 commits into from
Jan 29, 2024

Conversation

susanshi
Copy link
Collaborator

@susanshi susanshi commented Jan 24, 2024

Description

What this PR does / why we need it:

The download logic uses the source object to form the blob reference. However when a digest is used, the reference becomes malformed as the regex that looks for the blob reference would parse out the digest.

When a tag is passed:

{wabbitnetworks.azurecr.io/test/sample-store-plugin:v1 map[]}@sha256:26d320ceaa2d027ea2bceaae36a82e304782bbbbe92c8f0b1102482c596f32f5 (blob reference)

When a digest is passed:

{wabbitnetworks.azurecr.io/test/sample-store-plugin:294c517b9432a59f2d829f6d04912833a256560e4128aca86efa0c6b4ba6d44 map[]}@sha256:26d320ceaa2d027ea2bceaae36a82e304782bbbbe92c8f0b1102482c596f32f5 (blob reference)

@binbin-li followed up with Oras folks to confirm only the reference is required. This PR updates the code path to ONLY pass the blob to the oras library.

Which issue(s) this PR fixes (optional, using fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when the PR gets merged):

Fixes #1278

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Helm Chart Change (any edit/addition/update that is necessary for changes merged to the main branch)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Please also list any relevant details for your test configuration

Locally tested with dynamic plugin both using tag and digest

Checklist:

  • Does the affected code have corresponding tests?
  • Are the changes documented, not just with inline documentation, but also with conceptual documentation such as an overview of a new feature, or task-based documentation like a tutorial? Consider if this change should be announced on your project blog.
  • Does this introduce breaking changes that would require an announcement or bumping the major version?
  • Do all new files have appropriate license header?

Post Merge Requirements

  • MAINTAINERS: manually trigger the "Publish Package" workflow after merging any PR that indicates Helm Chart Change

Copy link

codecov bot commented Jan 24, 2024

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (2be797d) 61.72% compared to head (b998880) 61.69%.

Files Patch % Lines
pkg/common/plugin/download.go 40.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1280      +/-   ##
==========================================
- Coverage   61.72%   61.69%   -0.04%     
==========================================
  Files          97       97              
  Lines        6190     6192       +2     
==========================================
- Hits         3821     3820       -1     
- Misses       2038     2040       +2     
- Partials      331      332       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

akashsinghal
akashsinghal previously approved these changes Jan 24, 2024
Copy link
Collaborator

@akashsinghal akashsinghal left a comment

Choose a reason for hiding this comment

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

great catch. Thanks for the fix!

akashsinghal
akashsinghal previously approved these changes Jan 24, 2024
binbin-li
binbin-li previously approved these changes Jan 25, 2024
Copy link
Collaborator

@binbin-li binbin-li left a comment

Choose a reason for hiding this comment

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

lgtm overall, thanks for the fix!

@junczhu
Copy link
Collaborator

junczhu commented Jan 26, 2024

LGTM, thanks for the fix!

@susanshi susanshi dismissed stale reviews from akashsinghal and binbin-li via 6db2c43 January 29, 2024 23:07
@susanshi susanshi enabled auto-merge (squash) January 29, 2024 23:35
@susanshi susanshi merged commit 82626ee into ratify-project:main Jan 29, 2024
19 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dynamic plugin should support pulling image with digest
4 participants