project-copacetic / copacetic

🧵 CLI tool for directly patching container images!
https://project-copacetic.github.io/copacetic/
Apache License 2.0
882 stars 61 forks source link

feat: Add option to silent the patch output by using --silent flag #699

Open shishir-11 opened 1 month ago

shishir-11 commented 1 month ago

Add option to silent the patch output by using --silent flag.

copa patch -i $IMAGE --silent

does not produce output except some end INFO.

Closes #643

codecov[bot] commented 1 month ago

Codecov Report

Attention: Patch coverage is 4.34783% with 22 lines in your changes missing coverage. Please review.

Project coverage is 34.02%. Comparing base (9da1246) to head (deb5e30).

Files Patch % Lines
pkg/patch/patch.go 0.00% 21 Missing :warning:
pkg/patch/cmd.go 50.00% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #699 +/- ## ========================================== - Coverage 34.22% 34.02% -0.20% ========================================== Files 18 18 Lines 1578 1590 +12 ========================================== + Hits 540 541 +1 - Misses 1007 1018 +11 Partials 31 31 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

shishir-11 commented 1 month ago

the lint check is failing on a piece of code that is unrelated to me ? can someone help me fix that or is it fine eitherways

ashnamehrotra commented 1 month ago

@shishir-11 that lint error was fixed in #682, a rebase should fix that

shishir-11 commented 1 month ago

@ashnamehrotra can you please check if this is fine or something more needs to be done, thank you.

ashnamehrotra commented 1 month ago

@shishir-11 this looks good to me! I can do another review once the test pushed

shishir-11 commented 1 month ago

@ashnamehrotra can you please take a look at the failing unit test , do you know why that might be happening , is it possible it lacks permissions to execute apk update

ashnamehrotra commented 1 month ago

@ashnamehrotra can you please take a look at the failing unit test , do you know why that might be happening , is it possible it lacks permissions to execute apk update

It shouldn't need permissions to execute apk update, and copa is able to patch the image locally and run cmd_test.go locally. Could we try running with --debug to see the full error output?

shishir-11 commented 1 month ago

How do i run debug ? I'm unable to run it .

ashnamehrotra commented 1 month ago

How do i run debug ? I'm unable to run it .

Debug is part of newRootCmd rather than NewPatchCmd since it is a root level flag for copa, which is why it is failing here. I think it would make sense for silent to be the same, can we move it to the newRootCmd() function? We wouldn't be able to add test for this case in cmd_test.go, but it would make more sense to have it here.