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

feat(sync): sync references(signatures/artifacts) recursively #1500

Conversation

eusebiu-constantin-petu-dbk
Copy link
Collaborator

@eusebiu-constantin-petu-dbk eusebiu-constantin-petu-dbk commented Jun 8, 2023

What type of PR is this?
feature

Which issue does this PR fix:
#1334

What does this PR do / Why do we need it:
sync now also pulls chained artifacts recursively
eg:
image->sbom->sbom signature
image->artifact->artifact

If an issue # is not available please add repro steps and logs showing the issue:

Testing done on this change:

Automation added to e2e:

added chained artifacts in sync_test.go/TestSignatures()
Will this break upgrades or downgrades?
no
Does this PR introduce any user-facing change?:


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Copy link
Contributor

@andaaron andaaron left a comment

Choose a reason for hiding this comment

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

Can you also try to copy the cosign manifest blob as is instead of re-marshalling it? Maybe we don't need multiple implementations of the manifest that way.

pkg/extensions/sync/references/cosign.go Outdated Show resolved Hide resolved
pkg/extensions/sync/references/cosign.go Outdated Show resolved Hide resolved
pkg/extensions/sync/references/cosign.go Outdated Show resolved Hide resolved
pkg/extensions/sync/sync_test.go Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Jun 8, 2023

Codecov Report

Merging #1500 (4587f87) into main (d45cfbf) will increase coverage by 0.06%.
The diff coverage is 91.96%.

❗ Current head 4587f87 differs from pull request most recent head 96bd44b. Consider uploading reports for the commit 96bd44b to get more accurate results

@@            Coverage Diff             @@
##             main    #1500      +/-   ##
==========================================
+ Coverage   91.11%   91.17%   +0.06%     
==========================================
  Files         114      114              
  Lines       22751    22749       -2     
==========================================
+ Hits        20729    20741      +12     
+ Misses       1510     1498      -12     
+ Partials      512      510       -2     
Impacted Files Coverage Δ
pkg/extensions/sync/references/oras.go 83.33% <76.47%> (+0.72%) ⬆️
pkg/extensions/sync/references/oci.go 84.27% <80.95%> (+0.51%) ⬆️
pkg/extensions/sync/references/cosign.go 94.63% <96.87%> (+3.72%) ⬆️
pkg/api/routes.go 95.98% <100.00%> (-0.04%) ⬇️
pkg/common/common.go 93.93% <100.00%> (-0.18%) ⬇️
pkg/extensions/sync/references/references.go 96.80% <100.00%> (+0.72%) ⬆️
pkg/extensions/sync/service.go 95.23% <100.00%> (+2.22%) ⬆️
pkg/storage/local/local.go 81.83% <100.00%> (ø)
pkg/storage/s3/s3.go 82.67% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@eusebiu-constantin-petu-dbk eusebiu-constantin-petu-dbk force-pushed the sync_recursive_references branch 3 times, most recently from 5470f38 to b873e40 Compare June 8, 2023 19:01
andaaron
andaaron previously approved these changes Jun 8, 2023
pkg/extensions/sync/references/references.go Outdated Show resolved Hide resolved
andaaron
andaaron previously approved these changes Jun 9, 2023
andaaron
andaaron previously approved these changes Jun 12, 2023
@eusebiu-constantin-petu-dbk
Copy link
Collaborator Author

eusebiu-constantin-petu-dbk commented Jun 15, 2023

added test for infinite loops:

image -> sbom A -> oci ref -> sbom A

@eusebiu-constantin-petu-dbk eusebiu-constantin-petu-dbk force-pushed the sync_recursive_references branch 3 times, most recently from 2225730 to 95950f5 Compare June 16, 2023 09:27
andaaron
andaaron previously approved these changes Jun 16, 2023
sync now also pulls chained artifacts recursively
eg:
 image->sbom->sbom signature
 image->artifact->artifact

Signed-off-by: Petu Eusebiu <peusebiu@cisco.com>
Copy link
Contributor

@rchincha rchincha left a comment

Choose a reason for hiding this comment

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

lgtm

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.

[Feat]: sync should recursively download chained artifacts/references
3 participants