Skip to content

Commit f31119c

Browse files
committed
ci(gha): add steps to perform container image scan
1 parent 43fb209 commit f31119c

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

.github/workflows/pipeline.yml

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -219,26 +219,34 @@ jobs:
219219
# if: ${{ steps.bump-version.outputs.is-dryrun-version-bumped == 'true' }}
220220
uses: docker/build-push-action@v6
221221
with:
222-
push: false
222+
load: true
223223
tags: ${{ steps.meta.outputs.tags }}
224224
labels: ${{ steps.meta.outputs.labels }}
225225
sbom: true
226226
provenance: true
227227
- name: Convert Image to Tar
228-
run: docker save -o companieshouse.tar ${{ steps.meta.outputs.tags }}
228+
run: |
229+
docker images
230+
tags="${{ steps.meta.outputs.tags }}"
231+
tags="${tags//,/ }" # replace commas with spaces
232+
echo "Saving images: $tags"
229233
- name: Scan Image
230234
uses: aquasecurity/[email protected]
231235
with:
232-
image-ref: companieshouse.tar
236+
image-ref: ${{ steps.meta.outputs.tags }}
233237
format: 'table'
234238
exit-code: '1'
235239
ignore-unfixed: true
236240
vuln-type: 'os,library'
237241
scanners: 'vuln,secret,misconfig,license'
238-
- name: Push Image
239-
# if: ${{ github.event_name != 'pull_request' && steps.bump-version.outputs.is-dryrun-version-bumped == 'true' }} # Only push on main branch & when version is bumped with dryrun. We will create tags and creates separately after proper testing
240-
run: |
241-
docker push ${{ steps.meta.outputs.tags }}
242+
- name: Re-Build & Push Image
243+
uses: docker/build-push-action@v6
244+
with:
245+
push: true
246+
tags: ${{ steps.meta.outputs.tags }}
247+
labels: ${{ steps.meta.outputs.labels }}
248+
sbom: true
249+
provenance: true
242250

243251
# create-release:
244252
# if: ${{ needs.docker-build-push.outputs.is-dryrun-version-bumped == 'true' }} # Only release when new version is available

0 commit comments

Comments
 (0)