-
Notifications
You must be signed in to change notification settings - Fork 12
73 lines (65 loc) · 2.24 KB
/
scan-images.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
name: Scan image
on:
push:
branches:
- main
# pull_request:
schedule:
# 19:29 on Thursday
- cron: 29 19 * * 4
# every 2 hours (during evaluation)
- cron: 0 */2 * * *
jobs:
trivy-edge:
name: ${{ matrix.image }}
runs-on: ubuntu-latest
continue-on-error: true
strategy:
fail-fast: false
matrix:
# TODO: Get this list programmatically
image:
- 'openchallenges-apex'
- 'openchallenges-api-gateway'
- 'openchallenges-challenge-service'
- 'openchallenges-zipkin'
steps:
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull the image
run: |
docker pull ghcr.io/sage-bionetworks/${{ matrix.image }}:edge
# Deliberately chosen master here to keep up-to-date.
- name: Run Trivy vulnerability scanner for any major issues
uses: aquasecurity/trivy-action@master
with:
image-ref: ghcr.io/sage-bionetworks/${{ matrix.image }}:edge
ignore-unfixed: true
severity: 'CRITICAL,HIGH'
limit-severities-for-sarif: true
format: template
template: '@/contrib/sarif.tpl'
output: trivy-results-${{ matrix.image }}-edge.sarif
# Show all detected issues.
# Note this will show a lot more, including major un-fixed ones.
- name: Run Trivy vulnerability scanner for local output
uses: aquasecurity/trivy-action@master
with:
image-ref: ghcr.io/sage-bionetworks/${{ matrix.image }}:edge
format: table
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: trivy-results-${{ matrix.image }}-edge.sarif
category: ${{ matrix.image }}:edge image
wait-for-processing: true
- name: Detain results for debug if needed
uses: actions/upload-artifact@v3
with:
name: trivy-results-${{ matrix.image }}-edge.sarif
path: trivy-results-${{ matrix.image }}-edge.sarif
if-no-files-found: error