Skip to content

Commit

Permalink
[nc] iterate on artifact creation and upload
Browse files Browse the repository at this point in the history
Signed-off-by: Nic Cheneweth <[email protected]>
  • Loading branch information
ncheneweth committed Oct 21, 2024
1 parent fc16d77 commit 48859f3
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions snyk-scan/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ inputs:
instead the scan output will be uploaded as a pipeline artifact
required: false
default: "false"

runs:
using: "composite"

Expand All @@ -78,6 +79,12 @@ runs:
working-directory: ${{ inputs.working-directory }}
shell: bash
run: |
#!/usr/bin/env bash
set -eo pipefail
outfilename="${{ inputs.image }}_${{ inputs.tag }}_trivy_scan.log"
echo "outfilename=$outfilename" >> $GITHUB_ENV
if [[ ! ${{ inputs.snyk-skip-base-image }} ]]; then
skip_base_image=""
else
Expand All @@ -86,8 +93,19 @@ runs:
snyk config set api=${{ inputs.snyk-token }}
snyk config set org=${{ inputs.snyk-organization }}
snyk test ${{ inputs.snyk-additional-args }} \
$skip_base_image \
--docker ${{ inputs.registry }}/${{ inputs.organization }}/${{ inputs.image }}:${{ inputs.tag }} \
-file=${{ inputs.path }}/${{ inputs.dockerfile }} \
--policy-path=./.snyk \
--severity-threshold=${{ inputs.snyk-severity-threshold }} \
$skip_base_image
--severity-threshold=${{ inputs.snyk-severity-threshold }} 2>&1 | tee $outfilename
if [[ "${{ inputs.security-scan-nofail }}" == "true" ]]; then
exit 0
fi
- name: upload trivy scan log as saved artifact
if: ${{ inputs.security-scan-nofail == 'true' }}
uses: actions/upload-artifact@v4
with:
name: ${{ env.outfilename }}
path: ${{ env.outfilename }}
retention-days: 7

Check failure on line 111 in snyk-scan/action.yaml

View workflow job for this annotation

GitHub Actions / static code analysis / gha-tools-action static code analysis workflow

111:26 [new-line-at-end-of-file] no new line character at the end of file

0 comments on commit 48859f3

Please sign in to comment.