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: add ignore errors flags #247

Merged
merged 7 commits into from
Aug 22, 2023

Conversation

anubhav06
Copy link
Contributor

  • Added a new --ignore-errors flag
  • When this flag is used, even if we get an error while patching any of the packages, copa will still continue to produce an image.

Closes #203

How to test?

  1. trivy image --vuln-type os --ignore-unfixed -f json -o nginx.1.21.6.json mcr.microsoft.com/oss/nginx/nginx:1.21.6
  2. First, run copa without the --ignore-errors flag:
sudo copa patch -i mcr.microsoft.com/oss/nginx/nginx:1.21.6 -r nginx.1.21.6.json -t 1.21.6-patched

image
image

  1. Now run with the --ignore-errors flag enabled:
sudo copa patch -i mcr.microsoft.com/oss/nginx/nginx:1.21.6 -r nginx.1.21.6.json -t 1.21.6-patched --ignore-errors

image
image
image

We can see that despite the 2 errors, copa ignores them, and still produces an image

  1. Verified, that except those 2 packages, rest of the packages are patched:

image

Signed-off-by: Anubhav Gupta <mail.anubhav06@gmail.com>
@codecov
Copy link

codecov bot commented Aug 12, 2023

Codecov Report

Patch coverage: 43.33% and project coverage change: +0.79% 🎉

Comparison is base (fa9ead6) 28.51% compared to head (fd99e04) 29.30%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #247      +/-   ##
==========================================
+ Coverage   28.51%   29.30%   +0.79%     
==========================================
  Files          16       16              
  Lines        1487     1498      +11     
==========================================
+ Hits          424      439      +15     
+ Misses       1037     1034       -3     
+ Partials       26       25       -1     
Files Changed Coverage Δ
pkg/patch/patch.go 7.44% <0.00%> (ø)
pkg/pkgmgr/pkgmgr.go 12.98% <0.00%> (ø)
pkg/patch/cmd.go 53.33% <33.33%> (-0.24%) ⬇️
pkg/pkgmgr/apk.go 50.38% <57.14%> (+5.14%) ⬆️
pkg/pkgmgr/dpkg.go 33.57% <57.14%> (+0.73%) ⬆️
pkg/pkgmgr/rpm.go 33.15% <57.14%> (+0.53%) ⬆️

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

Signed-off-by: Anubhav Gupta <mail.anubhav06@gmail.com>
@sozercan sozercan added this to the v0.4.0 milestone Aug 16, 2023
Signed-off-by: Sertaç Özercan <852750+sozercan@users.noreply.github.com>
Copy link
Member

@sozercan sozercan left a comment

Choose a reason for hiding this comment

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

Thank you! LGTM

@sozercan sozercan merged commit ac5c027 into project-copacetic:main Aug 22, 2023
15 checks passed
@anubhav06 anubhav06 deleted the ignore-errors-flag branch August 22, 2023 17:54
ashnamehrotra pushed a commit to ashnamehrotra/copacetic that referenced this pull request Aug 25, 2023
Co-authored-by: Sertaç Özercan <852750+sozercan@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[REQ] flag to continue when there are errors
2 participants