static-web-apps-cli
static-web-apps-cli copied to clipboard
Getting zero exit code on deploy failure
Describe the bug There is an upload failure, but CLI returns 0 exit code.
To Reproduce Steps to reproduce the behavior:
- Given issue with SWA Azure - like this one => https://github.com/Azure/static-web-apps/issues/1097
- When running the command 'swa deploy --env production'
- Then I can see error in log
✖ Deployment Failed :( ✖ Deployment Failure Reason: Failed to deploy the Azure Functions. and exit code is "0"
Expected behavior Have non-zero exit code, to get failures in pipelines
Screenshots
Desktop (please complete the following information):
- OS: Debian GNU/Linux 11 (bullseye)
- Version 1.0.6
We are getting the same behaviour when trying to deploy a new env without any free slots available. Our workaround for pipelines is a shell script that greps the output for a keyword:
swa deploy -O build/your-app --env "full_env" 2>&1 | tee run.log
if grep -q BadRequest run.log; then exit 1; else exit 0; fi
the always 0 exit code makes it really hard to use this in any CI/CD scenario. I want to fail my GitHub Actions workflow if deploy fails, but since the swa
exit code is is 0, GitHub Actions assumes it succeeded (as will most/all CI systems).
yea it is anoying. We run into this from first try because 1st we thought "nice that was easy" but then "oh no, it errors but it does not fail".
It needs to return an error code, else we need to look into the job everytime.