Add error handling to Synopsys workflow wget and unzip commands#8
Add error handling to Synopsys workflow wget and unzip commands#8Copilot wants to merge 2 commits intoLukeLarge-patch-1from
Conversation
Co-authored-by: LukeLarge <162439255+LukeLarge@users.noreply.github.com>
Lawrence Lucas Large (LukeLarge)
left a comment
There was a problem hiding this comment.
Add error handling to Synopsys workflow wget and unzip commands
#8
There was a problem hiding this comment.
Pull request overview
Improves the Synopsys Intelligent Security Scan GitHub Actions workflow by making the Polaris download/extract step fail fast when a command errors, reducing confusing downstream failures.
Changes:
- Added
set -eto stop the step on first command failure. - Added
set -o pipefailto propagate failures through pipelines (when present).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| set -o pipefail | ||
| export POLARIS_SERVER_URL=${{ secrets.POLARIS_SERVER_URL}} | ||
| export POLARIS_ACCESS_TOKEN=${{ secrets.POLARIS_ACCESS_TOKEN}} | ||
| wget -q ${{ secrets.POLARIS_SERVER_URL}}/api/tools/polaris_cli-linux64.zip |
There was a problem hiding this comment.
The secret-expanded values should be quoted to avoid word-splitting/globbing if the URL/token contain special characters. Also, since POLARIS_SERVER_URL is exported, prefer using it for the wget URL to avoid duplicating the secret expression (and keep the command consistent with the exported env var).
| wget -q ${{ secrets.POLARIS_SERVER_URL}}/api/tools/polaris_cli-linux64.zip | |
| wget -q "${POLARIS_SERVER_URL}/api/tools/polaris_cli-linux64.zip" |
| @@ -43,6 +43,8 @@ jobs: | |||
| - name: Static Analysis with Polaris | |||
| if: ${{steps.prescription.outputs.sastScan == 'true' }} | |||
There was a problem hiding this comment.
set -o pipefail is shell-dependent (works in bash, not in plain sh). To ensure consistent behavior across runners/config, explicitly set the step shell to bash (e.g., add shell: bash to this step).
| if: ${{steps.prescription.outputs.sastScan == 'true' }} | |
| if: ${{steps.prescription.outputs.sastScan == 'true' }} | |
| shell: bash |
| set -o pipefail | ||
| export POLARIS_SERVER_URL=${{ secrets.POLARIS_SERVER_URL}} | ||
| export POLARIS_ACCESS_TOKEN=${{ secrets.POLARIS_ACCESS_TOKEN}} | ||
| wget -q ${{ secrets.POLARIS_SERVER_URL}}/api/tools/polaris_cli-linux64.zip |
There was a problem hiding this comment.
Using wget -q can suppress useful diagnostics in logs, which works against the stated goal of providing clearer error context when downloads fail. Consider using a less-silent mode (e.g., -nv) or removing -q so failures are easier to diagnose from workflow output.
| wget -q ${{ secrets.POLARIS_SERVER_URL}}/api/tools/polaris_cli-linux64.zip | |
| wget -nv ${{ secrets.POLARIS_SERVER_URL}}/api/tools/polaris_cli-linux64.zip |
Requires
Supports
Description
Addresses missing error handling in the Synopsys Intelligent Security Scan workflow. Without proper error handling,
wgetorunzipfailures (network issues, invalid URLs, corrupted archives) would allow the workflow to continue, causing unclear downstream failures.Changes
set -eandset -o pipefailto the Static Analysis with Polaris step shell script✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.