6868 path : ${{ github.workspace }}/.cache/trivy
6969 key : trivy-cache-${{ steps.date.outputs.date }}
7070
71+ - name : Restore NOFOs commit hash
72+ uses : actions/cache/restore@v4
73+ with :
74+ path : /tmp/commit-hash.txt
75+ key : nofos-commit-${{ github.sha }}-${{ github.run_id }}
76+
7177 - name : Restore cached Docker image
7278 uses : actions/cache/restore@v4
7379 with :
@@ -78,13 +84,11 @@ jobs:
7884 run : |
7985 docker load < /tmp/docker-image.tar
8086
81- - run : docker images
82-
8387 - name : Run Trivy vulnerability scan
8488 uses : aquasecurity/trivy-action@master
8589 with :
8690 scan-type : image
87- image-ref : nofos:latest
91+ image-ref : nofos:"$(cat /tmp/commit-hash.txt)"
8892 format : table
8993 exit-code : 1
9094 ignore-unfixed : true
@@ -117,6 +121,12 @@ jobs:
117121 rm .grype.yml
118122 mv new.grype.yml .grype.yml
119123
124+ - name : Restore NOFOs commit hash
125+ uses : actions/cache/restore@v4
126+ with :
127+ path : /tmp/commit-hash.txt
128+ key : nofos-commit-${{ github.sha }}-${{ github.run_id }}
129+
120130 - name : Restore cached Docker image
121131 uses : actions/cache/restore@v4
122132 with :
@@ -132,7 +142,7 @@ jobs:
132142 uses : anchore/scan-action@v4
133143 id : anchore-scan-json
134144 with :
135- image : nofos:latest
145+ image : nofos:"$(cat /tmp/commit-hash.txt)"
136146 output-format : json
137147 fail-build : true
138148 severity-cutoff : medium
@@ -141,7 +151,7 @@ jobs:
141151 if : always() # Runs even if there is a failure
142152 uses : anchore/scan-action@v4
143153 with :
144- image : nofos:latest
154+ image : nofos:"$(cat /tmp/commit-hash.txt)"
145155 output-format : table
146156 fail-build : true
147157 severity-cutoff : medium
@@ -158,6 +168,12 @@ jobs:
158168 steps :
159169 - uses : actions/checkout@v4
160170
171+ - name : Restore NOFOs commit hash
172+ uses : actions/cache/restore@v4
173+ with :
174+ path : /tmp/commit-hash.txt
175+ key : nofos-commit-${{ github.sha }}-${{ github.run_id }}
176+
161177 - name : Restore cached Docker image
162178 uses : actions/cache/restore@v4
163179 with :
@@ -179,7 +195,7 @@ jobs:
179195 - name : Run Dockle container linter
180196181197 with :
182- image : nofos:latest
198+ image : nofos:"$(cat /tmp/commit-hash.txt)"
183199 exit-code : " 1"
184200 failure-threshold : WARN
185201 accept-filenames : ${{ env.DOCKLE_ACCEPT_FILES }}
0 commit comments