GoogleContainerTools / skaffold

Easy and Repeatable Kubernetes Development
https://skaffold.dev/
Apache License 2.0
15.03k stars 1.62k forks source link

`--mute-logs` isn't respected if build fails #4816

Closed nkubala closed 4 years ago

nkubala commented 4 years ago

running skaffold build --mute-logs=build, I expect to see very little, even if the build fails. however, when the build does fail, skaffold prints all of the logs that it just wrote to a file to stdout, as well as the error that it just surfaced:

➜  bank-of-anthos git:(master) ✗ skaffold build --mute-logs=build 
Generating tags...
 - gcr.io/bank-of-anthos/frontend -> gcr.io/bank-of-anthos/frontend:v0.2.0-177-g3fa5bfc
Checking cache...
 - gcr.io/bank-of-anthos/frontend: Not found. Building
Building [gcr.io/bank-of-anthos/frontend]...
 - writing logs to /var/folders/p5/x30nywdn0xv1fjk394f2d6ch00cjy3/T/skaffold/build/gcr.io-bank-of-anthos-frontend.log
Sending build context to Docker daemon  102.9kB
Step 1/14 : FROM gcr.io/google-appengine/python
 ---> 96b4d9af6594
Step 2/14 : ENV PYTHONUNBUFFERED=0
 ---> Using cache
 ---> cb1f5814fcb5
...<redacted>...
Successfully built 686895e88703
Successfully tagged gcr.io/bank-of-anthos/frontend:v0.2.0-177-g3fa5bfc
The push refers to repository [gcr.io/bank-of-anthos/frontend]
a81218f0081a: Preparing
67b7ef169c5c: Preparing
...<redacted>...
ae3630d8a5da: Waiting
965eb7efdb65: Waiting
Build Failed. No push access to specified image repository. Trying running with `--default-repo` flag.

there's no reason we can't surface this error without dumping the entire logs that the user just explicitly asked to hide.

MarlonGamez commented 4 years ago

I think the idea when we first created this was that we would hide things from the user unless they went bad. Looking at it now that doesn't make a whole lot of sense since it's easy enough for the user to just view the log file after the fact if something goes bad, and we can just display the error message. I'll create a fix for this soon 👍🏼