Skip to content

Commit 909f903

Browse files
authored
Update to use trivy action (#106)
* Update to use trivy action * Minor fix
1 parent a4c962d commit 909f903

File tree

1 file changed

+5
-35
lines changed

1 file changed

+5
-35
lines changed

.github/workflows/build-trivy.yaml

Lines changed: 5 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -48,38 +48,8 @@ jobs:
4848
with:
4949
fetch-depth: 0
5050

51-
- name: Setup oras
52-
run: |
53-
VERSION="1.2.0"
54-
curl -LO "https://github.com/oras-project/oras/releases/download/v${VERSION}/oras_${VERSION}_linux_amd64.tar.gz"
55-
mkdir -p oras-install/
56-
tar -zxf oras_${VERSION}_*.tar.gz -C oras-install/
57-
sudo mv oras-install/oras /usr/local/bin/
58-
rm -rf oras_${VERSION}_*.tar.gz oras-install/
59-
60-
- name: Get current date
61-
id: date
62-
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
63-
64-
- name: Download and extract the vulnerability DB
65-
run: |
66-
mkdir -p $GITHUB_WORKSPACE/.cache/trivy/db
67-
oras pull ghcr.io/aquasecurity/trivy-db:2
68-
tar -xzf db.tar.gz -C $GITHUB_WORKSPACE/.cache/trivy/db
69-
rm db.tar.gz
70-
71-
- name: Download and extract the Java DB
72-
run: |
73-
mkdir -p $GITHUB_WORKSPACE/.cache/trivy/java-db
74-
oras pull ghcr.io/aquasecurity/trivy-java-db:1
75-
tar -xzf javadb.tar.gz -C $GITHUB_WORKSPACE/.cache/trivy/java-db
76-
rm javadb.tar.gz
77-
78-
- name: Trivy Scan
79-
shell: bash
80-
run: |
81-
DIR=`mktemp -d`
82-
curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b ${DIR} v0.51.2
83-
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin
84-
export TRIVY_CACHE=$GITHUB_WORKSPACE/.cache/trivy
85-
${DIR}/trivy fs --cache-dir ${TRIVY_CACHE} --exit-code 1 .
51+
- name: Run Trivy vulnerability scanner to scan repo
52+
uses: aquasecurity/trivy-action@0.29.0
53+
with:
54+
scan-type: 'fs'
55+
exit-code: 1

0 commit comments

Comments
 (0)