Skip to content

Commit 1fe9508

Browse files
Corneil du Plessisonobc
Corneil du Plessis
authored andcommitted
Provide for disabling security scan in ci-pr.yml and adding alternative repo
Added env to control the scan. Added env to identify alternate repo.
1 parent 4405e22 commit 1fe9508

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

.github/workflows/ci-pr.yml

+25
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ name: CI PRs
33
on:
44
pull_request:
55

6+
env:
7+
TRIVY_DB_REPOSITORY: public.ecr.aws/aquasecurity/trivy-db,aquasec/trivy-db,ghcr.io/aquasecurity/trivy-db
8+
TRIVY_JAVA_DB_REPOSITORY: public.ecr.aws/aquasecurity/trivy-java-db,aquasec/trivy-java-db,ghcr.io/aquasecurity/trivy-java-db
9+
610
jobs:
711
build:
812
runs-on: ubuntu-latest
@@ -17,3 +21,24 @@ jobs:
1721
timeout-minutes: 75
1822
run: |
1923
./mvnw -B -s .github/settings.xml -Pdocs clean install
24+
scan:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v4
28+
- name: Run Trivy vulnerability scanner in repo mode
29+
uses: aquasecurity/trivy-action@master
30+
with:
31+
scan-type: 'fs'
32+
ignore-unfixed: true
33+
format: 'table'
34+
severity: 'CRITICAL,HIGH'
35+
- name: 'Scanned'
36+
shell: bash
37+
run: echo "::info ::Scanned"
38+
done:
39+
runs-on: ubuntu-latest
40+
needs: [ scan, build ]
41+
steps:
42+
- name: 'Done'
43+
shell: bash
44+
run: echo "::info ::Done"

.github/workflows/ci.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
inputs:
66
enableSecurityScan:
77
type: boolean
8-
default: false
8+
default: true
99
description: 'Enable security scan with Trivy'
1010
push:
1111
branches:
@@ -15,6 +15,8 @@ on:
1515

1616
env:
1717
MAVEN_THREADS: '-T 1'
18+
TRIVY_DB_REPOSITORY: public.ecr.aws/aquasecurity/trivy-db,aquasec/trivy-db,ghcr.io/aquasecurity/trivy-db
19+
TRIVY_JAVA_DB_REPOSITORY: public.ecr.aws/aquasecurity/trivy-java-db,aquasec/trivy-java-db,ghcr.io/aquasecurity/trivy-java-db
1820

1921
jobs:
2022
build:
@@ -193,7 +195,7 @@ jobs:
193195
GCR_JSON_KEY: ${{ secrets.GCR_JSON_KEY }}
194196
scan:
195197
runs-on: ubuntu-latest
196-
if: ${{ inputs.enableSecurityScan != null && inputs.enableSecurityScan }}
198+
if: ${{ inputs.enableSecurityScan == null || inputs.enableSecurityScan }}
197199
steps:
198200
- uses: actions/checkout@v4
199201
- name: Run Trivy vulnerability scanner in repo mode

0 commit comments

Comments
 (0)