Skip to content

Commit 32aab16

Browse files
authored
run workflow on dispatch event and use token from secrets (#48)
Signed-off-by: Shubham Chaudhary <[email protected]>
1 parent 449b149 commit 32aab16

File tree

2 files changed

+32
-17
lines changed

2 files changed

+32
-17
lines changed

.github/workflows/build.yml

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -36,23 +36,6 @@ jobs:
3636
- name: Build Image
3737
run: make build
3838

39-
40-
security:
41-
container:
42-
image: litmuschaos/snyk:1.0
43-
volumes:
44-
- /home/runner/work/_actions/:/home/runner/work/_actions/
45-
runs-on: ubuntu-latest
46-
steps:
47-
- uses: actions/checkout@v2
48-
- uses: snyk/actions/setup@master
49-
- name: Install packages
50-
run: pip3 install -r requirements.txt
51-
- run: snyk auth ${SNYK_TOKEN}
52-
- name: Snyk monitor
53-
run: snyk test --file=requirements.txt --command=python3
54-
55-
5639
trivy:
5740
runs-on: ubuntu-latest
5841
steps:
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
name: Security Scan
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
snyk:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@master
11+
- name: Run Snyk to check for vulnerabilities
12+
uses: snyk/actions/python@master
13+
env:
14+
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
15+
16+
trivy:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@master
20+
- name: Build an image from Dockerfile
21+
run: |
22+
docker build -f build/Dockerfile -t docker.io/litmuschaos/py-runner:${{ github.sha }} . --build-arg TARGETARCH=amd64
23+
24+
- name: Run Trivy vulnerability scanner
25+
uses: aquasecurity/trivy-action@master
26+
with:
27+
image-ref: 'docker.io/litmuschaos/py-runner:${{ github.sha }}'
28+
format: 'table'
29+
exit-code: '1'
30+
ignore-unfixed: true
31+
vuln-type: 'os,library'
32+
severity: 'CRITICAL,HIGH'

0 commit comments

Comments
 (0)