Skip to content

Commit 872ce9f

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

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

.github/workflows/pipeline.yml

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -219,26 +219,32 @@ 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 }}
225-
sbom: true
226-
provenance: true
227225
- name: Convert Image to Tar
228-
run: docker save -o companieshouse.tar ${{ steps.meta.outputs.tags }}
226+
run: |
227+
docker images
228+
tags="${{ steps.meta.outputs.tags }}"
229+
tags="${tags//,/ }" # replace commas with spaces
230+
echo "Saving images: $tags"
229231
- name: Scan Image
230232
uses: aquasecurity/[email protected]
231233
with:
232-
image-ref: companieshouse.tar
234+
image-ref: ${{ steps.meta.outputs.tags }}
233235
format: 'table'
234236
exit-code: '1'
235237
ignore-unfixed: true
236238
vuln-type: 'os,library'
237239
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 }}
240+
- name: Re-Build & Push Image
241+
uses: docker/build-push-action@v6
242+
with:
243+
push: true
244+
tags: ${{ steps.meta.outputs.tags }}
245+
labels: ${{ steps.meta.outputs.labels }}
246+
sbom: true
247+
provenance: true
242248

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

0 commit comments

Comments
 (0)