-
Notifications
You must be signed in to change notification settings - Fork 2
47 lines (39 loc) · 1.22 KB
/
build-and-test.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
name: Build and Test Docker Image
on:
push:
branches-ignore:
- latest
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Run Development Pipeline
run: make dev-pipeline
working-directory: .
- name: Cache Trivy DB
uses: actions/cache@v3
with:
path: ~/.cache/trivy
key: ${{ runner.os }}-trivy-db
restore-keys: |
${{ runner.os }}-trivy-db
- name: Install Trivy
run: |
curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sudo sh -s -- -b /usr/local/bin
- name: Trivy Scanning
run: |
trivy image --severity HIGH,CRITICAL --exit-code 0 --quiet --retry 3 udx-worker/udx-worker:latest | tee trivy.log | grep -v 'INFO'
if grep -E "Total: [1-9]" trivy.log; then
echo "HIGH or CRITICAL vulnerabilities detected!"
exit 1
else
echo "No HIGH or CRITICAL vulnerabilities found."
fi