-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (48 loc) · 1.54 KB
/
trivy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: Trivy
on: workflow_dispatch
jobs:
trivy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: 'gradle'
- name: Build all projects without running tests
run: ./gradlew --build-cache build -x test -x spotlessCheck
- name: Construct docker image name and tag
id: image-name
run: |
echo "name=trivy-local-testing-image" >> $GITHUB_OUTPUT
- name: Build image locally with jib
run: |
./gradlew --build-cache :service:jibDockerBuild \
--image="${IMAGE_NAME}" \
-Djib.console=plain
env:
IMAGE_NAME: ${{ steps.image-name.outputs.name }}
- name: Run Trivy vulnerability scanner
uses: broadinstitute/dsp-appsec-trivy-action@v1
with:
image: ${{ steps.image-name.outputs.name }}
notify-slack:
needs: [ trivy ]
runs-on: ubuntu-latest
if: failure()
steps:
- name: Notify slack on failure
uses: broadinstitute/action-slack@v3.15.0
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
with:
channel: ${{ vars.SLACK_NOTIFICATION_CHANNELS }}
status: failure
author_name: Trivy action
fields: workflow,message
text: 'Trivy scan failure :sadpanda:'
username: 'Data Explorer GitHub Action'