File tree Expand file tree Collapse file tree 1 file changed +29
-6
lines changed Expand file tree Collapse file tree 1 file changed +29
-6
lines changed Original file line number Diff line number Diff line change @@ -48,15 +48,38 @@ jobs:
48
48
with :
49
49
fetch-depth : 0
50
50
51
- - name : Set up JDK
52
- uses : actions/setup-java@v4
53
- with :
54
- java-version : ' 11'
55
- distribution : ' zulu'
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
56
77
57
78
- name : Trivy Scan
58
79
shell : bash
59
80
run : |
60
81
DIR=`mktemp -d`
61
82
curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b ${DIR} v0.51.2
62
- ${DIR}/trivy fs --exit-code 1 .
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 .
You can’t perform that action at this time.
0 commit comments