I have this command:
coverage report | tee >(grep TOTAL | awk '{exit (int($4) >= 75)?0:1}') && (exit ${PIPESTATUS[0]})
which reports the code coverage and then prints the output to stdout
and redirects that same output to a grep + awk, which basically checks whether the code coverage covers less or more than 75
. Finally, there is an exit
in a subshell, which I pretend to use in my CI/CD pipeline.
The problem is that my CI/CD always completes successfully, which shouldn't happen as the code coverage is less than 75% in my tests. That means that the PIEPSTATUS
isn't returning what I'm expecting it to return (awk's exit
code).
Where is the problem? What am I doing wrong?