Skip to content

Commit ba57f12

Browse files
committed
(maint) Add Trivy to 4.x publish
This adds a Trivy scan to the 4.x publish action. Since vulnerabilities can be discovered at any time, we want to double check the dev image before we publish to 4.x. As part of adding the Trivy step, this also splits out the docker pull part of the action, which saves time on the Trivy scan that was timing out.
1 parent 8b02d78 commit ba57f12

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

.github/workflows/publish-4x-image.yml

+15-3
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,32 @@ on:
1313
jobs:
1414
publish-4x-image:
1515
runs-on: ubuntu-latest
16+
env:
17+
IMAGE_BASE: "${{ secrets.DOCKERHUB_PUSH_USERNAME }}/puppet-dev-tools"
1618
steps:
1719
- name: Login to Docker Hub
1820
run: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_LOGIN_USERNAME }} --password-stdin
19-
- name: Publish standard image to 4.x
21+
- name: Pull image
2022
env:
21-
IMAGE_BASE: "${{ secrets.DOCKERHUB_PUSH_USERNAME }}/puppet-dev-tools"
2223
IMAGE_TAG: ${{ github.event.inputs.image_tag }}
2324
run: |
2425
docker pull ${IMAGE_BASE}:${IMAGE_TAG}
26+
- name: Trivy scan
27+
uses: aquasecurity/trivy-action@master
28+
with:
29+
image-ref: ${{ env.IMAGE_BASE }}:${{ github.event.inputs.image_tag }}
30+
exit-code: 1
31+
ignore-unfixed: true
32+
severity: 'CRITICAL,HIGH,MEDIUM'
33+
vuln-type: os
34+
- name: Publish standard image to 4.x
35+
env:
36+
IMAGE_TAG: ${{ github.event.inputs.image_tag }}
37+
run: |
2538
docker tag ${IMAGE_BASE}:${IMAGE_TAG} ${IMAGE_BASE}:4.x
2639
docker push ${IMAGE_BASE}:4.x
2740
- name: Publish rootless image to 4.x-rootless
2841
env:
29-
IMAGE_BASE: "${{ secrets.DOCKERHUB_PUSH_USERNAME }}/puppet-dev-tools"
3042
IMAGE_TAG: ${{ github.event.inputs.image_tag_rootless }}
3143
run: |
3244
docker pull ${IMAGE_BASE}:${IMAGE_TAG}

0 commit comments

Comments
 (0)