enterprise-contract / ec-cli

Supply chain artifact verifier and policy checker
https://enterprisecontract.dev/docs/ec-cli/
Apache License 2.0
28 stars 29 forks source link

Refactor everything relating to OCI client #1601

Closed zregvart closed 5 months ago

zregvart commented 5 months ago

This refactors all codepaths to use the single OCI client abstraction and a single fake/mock in testing.

Now all options provided to go-containerregistry are maintaned in the single place internal/utils/oci/client.go.

codecov[bot] commented 5 months ago

Codecov Report

Attention: Patch coverage is 65.30612% with 34 lines in your changes are missing coverage. Please review.

Project coverage is 87.25%. Comparing base (e72483b) to head (0c8f7b3). Report is 3 commits behind head on main.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/enterprise-contract/ec-cli/pull/1601/graphs/tree.svg?width=650&height=150&src=pr&token=CY5ORXJB33&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=enterprise-contract)](https://app.codecov.io/gh/enterprise-contract/ec-cli/pull/1601?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=enterprise-contract) ```diff @@ Coverage Diff @@ ## main #1601 +/- ## ========================================== + Coverage 80.79% 87.25% +6.46% ========================================== Files 65 75 +10 Lines 4738 5045 +307 ========================================== + Hits 3828 4402 +574 + Misses 910 643 -267 ``` | [Flag](https://app.codecov.io/gh/enterprise-contract/ec-cli/pull/1601/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=enterprise-contract) | Coverage Δ | | |---|---|---| | [acceptance](https://app.codecov.io/gh/enterprise-contract/ec-cli/pull/1601/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=enterprise-contract) | `72.71% <64.28%> (?)` | | | [generative](https://app.codecov.io/gh/enterprise-contract/ec-cli/pull/1601/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=enterprise-contract) | `80.70% <48.97%> (-0.10%)` | :arrow_down: | | [integration](https://app.codecov.io/gh/enterprise-contract/ec-cli/pull/1601/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=enterprise-contract) | `80.70% <48.97%> (-0.10%)` | :arrow_down: | | [unit](https://app.codecov.io/gh/enterprise-contract/ec-cli/pull/1601/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=enterprise-contract) | `80.70% <48.97%> (-0.10%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=enterprise-contract#carryforward-flags-in-the-pull-request-comment) to find out more. | [Files](https://app.codecov.io/gh/enterprise-contract/ec-cli/pull/1601?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=enterprise-contract) | Coverage Δ | | |---|---|---| | [internal/applicationsnapshot/input.go](https://app.codecov.io/gh/enterprise-contract/ec-cli/pull/1601?src=pr&el=tree&filepath=internal%2Fapplicationsnapshot%2Finput.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=enterprise-contract#diff-aW50ZXJuYWwvYXBwbGljYXRpb25zbmFwc2hvdC9pbnB1dC5nbw==) | `93.38% <100.00%> (+10.53%)` | :arrow_up: | | [internal/fetchers/oci/config/config.go](https://app.codecov.io/gh/enterprise-contract/ec-cli/pull/1601?src=pr&el=tree&filepath=internal%2Ffetchers%2Foci%2Fconfig%2Fconfig.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=enterprise-contract#diff-aW50ZXJuYWwvZmV0Y2hlcnMvb2NpL2NvbmZpZy9jb25maWcuZ28=) | `96.87% <100.00%> (ø)` | | | [internal/fetchers/oci/files/files.go](https://app.codecov.io/gh/enterprise-contract/ec-cli/pull/1601?src=pr&el=tree&filepath=internal%2Ffetchers%2Foci%2Ffiles%2Ffiles.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=enterprise-contract#diff-aW50ZXJuYWwvZmV0Y2hlcnMvb2NpL2ZpbGVzL2ZpbGVzLmdv) | `91.30% <100.00%> (ø)` | | | [internal/rego/oci/oci.go](https://app.codecov.io/gh/enterprise-contract/ec-cli/pull/1601?src=pr&el=tree&filepath=internal%2Frego%2Foci%2Foci.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=enterprise-contract#diff-aW50ZXJuYWwvcmVnby9vY2kvb2NpLmdv) | `96.59% <100.00%> (-0.15%)` | :arrow_down: | | [internal/rego/sigstore/sigstore.go](https://app.codecov.io/gh/enterprise-contract/ec-cli/pull/1601?src=pr&el=tree&filepath=internal%2Frego%2Fsigstore%2Fsigstore.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=enterprise-contract#diff-aW50ZXJuYWwvcmVnby9zaWdzdG9yZS9zaWdzdG9yZS5nbw==) | `94.94% <100.00%> (+0.56%)` | :arrow_up: | | [internal/utils/testing\_image.go](https://app.codecov.io/gh/enterprise-contract/ec-cli/pull/1601?src=pr&el=tree&filepath=internal%2Futils%2Ftesting_image.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=enterprise-contract#diff-aW50ZXJuYWwvdXRpbHMvdGVzdGluZ19pbWFnZS5nbw==) | `0.00% <ø> (ø)` | | | [...ation\_snapshot\_image/application\_snapshot\_image.go](https://app.codecov.io/gh/enterprise-contract/ec-cli/pull/1601?src=pr&el=tree&filepath=internal%2Fevaluation_target%2Fapplication_snapshot_image%2Fapplication_snapshot_image.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=enterprise-contract#diff-aW50ZXJuYWwvZXZhbHVhdGlvbl90YXJnZXQvYXBwbGljYXRpb25fc25hcHNob3RfaW1hZ2UvYXBwbGljYXRpb25fc25hcHNob3RfaW1hZ2UuZ28=) | `77.71% <87.50%> (+15.15%)` | :arrow_up: | | [internal/utils/oci/client.go](https://app.codecov.io/gh/enterprise-contract/ec-cli/pull/1601?src=pr&el=tree&filepath=internal%2Futils%2Foci%2Fclient.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=enterprise-contract#diff-aW50ZXJuYWwvdXRpbHMvb2NpL2NsaWVudC5nbw==) | `57.69% <57.69%> (ø)` | | ... and [38 files with indirect coverage changes](https://app.codecov.io/gh/enterprise-contract/ec-cli/pull/1601/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=enterprise-contract)
lcarva commented 5 months ago

Thanks for doing this much needed re-factoring. It's beautiful :pinched_fingers:

zregvart commented 5 months ago

Merging this now, if there are any followups feel free to create issues for them...