Skip to content

Commit ab1ad17

Browse files
authored
Update trivy.yml
1 parent ee85da0 commit ab1ad17

1 file changed

Lines changed: 24 additions & 16 deletions

File tree

.github/workflows/trivy.yml

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,28 @@
11
name: Trivy Scan
22
on:
3-
push:
4-
branches: [ main ]
3+
push:
4+
branches: [ main ]
5+
56
jobs:
6-
scan:
7-
runs-on: ubuntu-latest
8-
steps:
9-
- name: Checkout Code
10-
uses: actions/checkout@v3
7+
scan:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- name: Checkout code
12+
uses: actions/checkout@v3
13+
14+
- name: Install dependencies
15+
run: |
16+
sudo apt-get update -y
17+
sudo apt-get install -y wget apt-transport-https ca-certificates
18+
19+
- name: Install Trivy
20+
run: |
21+
wget https://github.com/aquasecurity/trivy/releases/latest/download/trivy_Linux-64bit.deb
22+
sudo dpkg -i trivy_Linux-64bit.deb
23+
24+
- name: Build Docker image
25+
run: docker build -t devsecops-scan .
1126

12-
- name: Install Trivy
13-
run: |
14-
sudo apt-get install wget -y
15-
wget https://github.com/aquasecurity/trivy/releases/latest/download/trivy_Linux-64bit.deb
16-
sudo dpkg -i trivy_Linux-64bit.deb
17-
- name: Build Docker Image
18-
run: docker build -t devsecops-scan .
19-
- name: Run Trivy Scan
20-
run: trivy image --exit-code 1 --severity HIGH,CRITICAL devsecops-scan
27+
- name: Run Trivy image scan (fail on HIGH/CRITICAL)
28+
run: trivy image --exit-code 1 --severity HIGH,CRITICAL devsecops-scan

0 commit comments

Comments
 (0)