Skip to content

Commit 2065127

Browse files
authored
Merge pull request #121 from puppetlabs/maint/add-trivy-scan-action
Add Trivy scans to github actions
2 parents 2cdf26c + ba57f12 commit 2065127

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

.github/workflows/build-test-push.yml

+8
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@ jobs:
1313
run: ./build-rootless.sh $(echo $GITHUB_REPOSITORY |cut -d '/' -f1)
1414
- name: Build standard image
1515
run: ./build.sh $(echo $GITHUB_REPOSITORY |cut -d '/' -f1)
16+
- name: Trivy scan
17+
uses: aquasecurity/trivy-action@master
18+
with:
19+
image-ref: puppet-dev-tools:latest
20+
exit-code: 1
21+
ignore-unfixed: true
22+
severity: 'CRITICAL,HIGH,MEDIUM'
23+
vuln-type: os
1624
- name: Run tests
1725
run: cd tests; ./run_tests.sh
1826
- name: Tag Docker images

.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)