Skip to content

Commit

Permalink
try using trivy directly instead of trivy-action
Browse files Browse the repository at this point in the history
  • Loading branch information
rkm committed Jun 19, 2024
1 parent 2ebbbb0 commit 30e0d8b
Showing 1 changed file with 30 additions and 15 deletions.
45 changes: 30 additions & 15 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ jobs:
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true
docker-images: false
- name: build image
if: env.SKIP == '0'
run: |
Expand All @@ -63,20 +62,36 @@ jobs:
docker image ls -a --digests --no-trunc
- name: run trivy
if: env.SKIP == '0'
uses: aquasecurity/trivy-action@master
with:
image-ref: "${{ env.img }}:${{ env.tag }}"
format: 'github'
output: 'dependency-results.sbom.json'
github-pat: "${{ secrets.GITHUB_TOKEN }}"
severity: 'MEDIUM,CRITICAL,HIGH'
scanners: "vuln"
- name: upload trivy report
if: env.SKIP == '0' && !cancelled()
uses: actions/upload-artifact@v4
with:
name: 'trivy-sbom-report-${{ matrix.package }}'
path: 'dependency-results.sbom.json'
run: |
set -euxo pipefail
out_dir=$(mktemp -d)
docker run \
-v /var/run/docker.sock:/var/run/docker.sock \
-v "${out_dir}":/out
docker.io/aquasec/trivy:0.52.2 \
image \
--scaners vuln \
--severity MEDIUM,HIGH,CRITICAL \
--output /out/dependency-results.sbom.json \
"$img:$tag"
ls -la "${out_dir}"
# - name: run trivy
# if: env.SKIP == '0'
# uses: aquasecurity/trivy-action@master
# with:
# image-ref: "${{ env.img }}:${{ env.tag }}"
# format: 'github'
# output: 'dependency-results.sbom.json'
# github-pat: "${{ secrets.GITHUB_TOKEN }}"
# severity: 'MEDIUM,CRITICAL,HIGH'
# scanners: "vuln"
# TODO
# - name: upload trivy report
# if: env.SKIP == '0' && !cancelled()
# uses: actions/upload-artifact@v4
# with:
# name: 'trivy-sbom-report-${{ matrix.package }}'
# path: 'dependency-results.sbom.json'
- name: push image
if: env.SKIP == '0' && github.ref == 'refs/heads/main'
run: |
Expand Down

0 comments on commit 30e0d8b

Please sign in to comment.