-
Notifications
You must be signed in to change notification settings - Fork 29
64 lines (57 loc) · 1.85 KB
/
trivy_scan.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
name: Scan pmm server and client docker images
on:
schedule:
- cron: '0 7 * * 1'
workflow_dispatch:
inputs:
server_image:
description: "pmm-server docker image"
required: false
default: perconalab/pmm-server:dev-latest
type: string
client_image:
description: "pmm-client docker image"
default: perconalab/pmm-client:dev-latest
required: false
type: string
jobs:
scan:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- image: ${{ inputs.server_image || 'perconalab/pmm-server:dev-latest' }}
- image: ${{ inputs.client_image || 'perconalab/pmm-client:dev-latest' }}
steps:
- name: Set report filename
run: |
echo "REPORT=$(echo ${{ matrix.image }} | cut -d'/' -f2 | tr ':' '-')" >> $GITHUB_ENV
- name: Run trivy scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: ${{ matrix.image }}
format: 'table'
exit-code: '1'
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH'
output: ${{ env.REPORT }}
- name: Archive trivy scan results
if: always()
uses: actions/upload-artifact@v4
with:
name: ${{ env.REPORT }}
path: ${{ env.REPORT }}
retention-days: 7
- name: Send Slack notification on failure
if: ${{ failure() }}
uses: percona/gh-action-action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_TOKEN }}
SLACK_USERNAME: "trivy scanner"
SLACK_ICON_EMOJI: ":squirrel:"
SLACK_COLOR: "#FF0000"
SLACK_TITLE: "CVE Scan failure"
SLACK_MESSAGE: "Failed CVE scan for ${{ matrix.image }}"
SLACK_FOOTER: "Please check the Actions URL ^"