Skip to content

Commit 30317f7

Browse files
[CI] Add linter workflow for Dockerfiles: Trivy
1 parent 7becea0 commit 30317f7

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

.github/workflows/trivy.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Runs linter for Docker files
2+
name: Trivy
3+
4+
on:
5+
workflow_dispatch:
6+
push:
7+
pull_request:
8+
paths:
9+
- '.github/docker/*Dockerfile'
10+
- '.github/workflows/trivy.yml'
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
trivy:
17+
name: Trivy
18+
runs-on: ubuntu-latest
19+
permissions:
20+
security-events: write
21+
22+
steps:
23+
- name: Clone the git repo
24+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
25+
26+
- name: Run Trivy
27+
uses: aquasecurity/trivy-action@84384bd6e777ef152729993b8145ea352e9dd3ef # v0.17.0
28+
with:
29+
scan-type: 'config'
30+
hide-progress: false
31+
format: 'sarif'
32+
output: 'trivy-results.sarif'
33+
exit-code: 1 # Fail if issue found
34+
# See .trivyignore file with suppressions
35+
36+
- name: Upload results
37+
uses: github/codeql-action/upload-sarif@e8893c57a1f3a2b659b6b55564fdfdbbd2982911 # v3.24.0
38+
with:
39+
sarif_file: 'trivy-results.sarif'

.trivyignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Docs: https://aquasecurity.github.io/trivy/latest/docs/configuration/filtering/#trivyignore
2+
3+
# In docker files:
4+
# non-root user is always created within docker, but we switch it only in CI workflows;
5+
# not enforcing non-root user makes it easier for developers to use their own users in local container
6+
AVD-DS-0002
7+
8+
# In docker files:
9+
# HEALTHCHECK is not required for development, nor in CI (failed docker = failed CI)
10+
AVD-DS-0026

0 commit comments

Comments
 (0)