-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (49 loc) · 1.73 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
name: Trivy Vulnerability and IaC Scanning
on:
push:
branches:
- main # Triggers the workflow on push events to the main branch.
jobs:
trivy-scan:
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v2
- name: Install Trivy
run: |
sudo apt-get update
sudo apt-get install -y apt-transport-https gnupg lsb-release
curl -fsSL https://aquasecurity.github.io/trivy-repo/deb/public.key | sudo apt-key add -
echo deb https://aquasecurity.github.io/trivy-repo/deb $(lsb_release -sc) main | sudo tee -a /etc/apt/sources.list.d/trivy.list
sudo apt-get update
sudo apt-get install trivy
- name: Scan the filesystem in the repository and output results
run: |
trivy fs . > filesystem-scan-report.txt
continue-on-error: true
- name: Upload Filesystem Scan Report
uses: actions/upload-artifact@v2
if: always()
with:
name: Filesystem-Scan-Report
path: filesystem-scan-report.txt
- name: Scan the Git repository and output results
run: |
trivy repo https://github.com/${{ github.repository }} > git-repo-scan-report.txt
continue-on-error: true
- name: Upload Git Repository Scan Report
uses: actions/upload-artifact@v2
if: always()
with:
name: Git-Repo-Scan-Report
path: git-repo-scan-report.txt
- name: Scan Infrastructure as Code (IaC) files and output results
run: |
trivy config . > iac-scan-report.txt
continue-on-error: true
- name: Upload IaC Scan Report
uses: actions/upload-artifact@v2
if: always()
with:
name: IaC-Scan-Report
path: iac-scan-report.txt