File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed
.github/actions/scan-image Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,13 @@ inputs:
1212runs :
1313 using : composite
1414 steps :
15+ - name : Get image id
16+ id : image-id
17+ shell : bash
18+ run : |
19+ image_id=$(${{github.action_path}}/image_id.sh '${{ inputs.image-ref }}')
20+ echo "image_id=$image_id" >> $GITHUB_OUTPUT
21+
1522 - name : Scan image
1623 uses :
aquasecurity/[email protected] 1724 with :
3542 uses : github/codeql-action/upload-sarif@v3
3643 with :
3744 sarif_file : trivy-results.sarif
45+ category : ' image-scan:${{ steps.image-id.outputs.image_id }}'
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ set -e
4+
5+ if [ " $# " -ne 1 ] || [ " $1 " == " " ] || [ " $1 " == " -h" ] || [ " $1 " == " --help" ]; then
6+ echo " Usage: $0 <image_id>"
7+ exit 1
8+ fi
9+
10+ image_id=" $1 "
11+ image_id=$( echo " $image_id " | cut -d' @' -f1) # remove digest
12+ # make sure if there is only one colon it is not the port
13+ if ! echo " $image_id " | rev | cut -d' :' -f1 | rev | grep -q ' /' ; then
14+ image_id=$( echo " $image_id " | rev | cut -d' :' -f2- | rev) # remove tag
15+ fi
16+
17+ echo -n " $image_id "
You can’t perform that action at this time.
0 commit comments