Hi all,
I’m setting up sa quick check to avoid being able to push unsafe dependencies. We are using yarn
and updating it right before, I tried to run the same commands ssh-ing into the failed job and they seems to work as expected.
Unsafe run
Last run with safe dependencies
#!/bin/bash -eo pipefail
SUMMARY="$(yarn audit | grep Severity)"
VULNERABILITIES=".*(High|Critical).*"
if [[ $SUMMARY =~ $VULNERABILITIES ]]; then
echo "Unsafe dependencies found: $SUMMARY"
exit 1
fi
echo "Your dependencies are secure enough: $SUMMARY"
exit 0
# outcome if is safe Exited with code 2
# outcome if unsafe Exited with code 10
Am I doing something wrong in using the command?
With SSH I tried the oneliner version:
SUMMARY="$(yarn audit | grep Severity)" ; VULNERABILITIES=".*(High|Critical).*" ; if [[ $SUMMARY =~ $VULNERABILITIES ]]; then echo "problems $SUMMARY" >&2; exit 1 ; fi ; echo "OK $SUMMARY" ; exit 0
And it worked as I would expect in SSH, exit with exit code 2 on workflow
Oneliner that should exit 0
Thanks,
Karoly