Skip to content

Commit 0b302e6

Browse files
authored
Merge pull request #1599 from lukaszstolarczuk/enable-trivy
[CI] Change docker linter from hadolint to trivy
2 parents 4c69624 + 2d6f903 commit 0b302e6

File tree

4 files changed

+59
-36
lines changed

4 files changed

+59
-36
lines changed

.github/docker/ubuntu-22.04.Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ RUN /opt/install_dpcpp.sh
6767
COPY install_libbacktrace.sh /opt/install_libbacktrace.sh
6868
RUN /opt/install_libbacktrace.sh
6969

70-
# Add a new (non-root) 'user'
71-
ENV USER user
70+
# Add a new (non-root) 'test_user' and switch to it
71+
ENV USER test_user
7272
ENV USERPASS pass
7373
RUN useradd -m "${USER}" -g sudo -p "$(mkpasswd ${USERPASS})"
74+
USER test_user

.github/workflows/hadolint.yml

Lines changed: 0 additions & 34 deletions
This file was deleted.

.github/workflows/trivy.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
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+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
14+
cancel-in-progress: true
15+
16+
permissions:
17+
contents: read
18+
19+
jobs:
20+
linux:
21+
name: Trivy
22+
runs-on: ubuntu-latest
23+
permissions:
24+
security-events: write
25+
26+
steps:
27+
- name: Clone repo
28+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
29+
30+
- name: Run Trivy
31+
uses: aquasecurity/trivy-action@84384bd6e777ef152729993b8145ea352e9dd3ef # v0.17.0
32+
with:
33+
scan-type: 'config'
34+
hide-progress: false
35+
format: 'sarif'
36+
output: 'trivy-results.sarif'
37+
exit-code: 1 # Fail if issue found
38+
# file with suppressions: .trivyignore (in root dir)
39+
40+
- name: Print report and trivyignore file
41+
run: |
42+
echo "### Trivy ignore content:"
43+
cat .trivyignore
44+
echo "### Trivy report:"
45+
cat trivy-results.sarif
46+
47+
- name: Upload results
48+
uses: github/codeql-action/upload-sarif@e8893c57a1f3a2b659b6b55564fdfdbbd2982911 # v3.24.0
49+
with:
50+
sarif_file: 'trivy-results.sarif'

.trivyignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Docs: https://aquasecurity.github.io/trivy/latest/docs/configuration/filtering/#trivyignore
2+
3+
# In docker files:
4+
# HEALTHCHECK is not required for development, nor in CI (failed docker = failed CI).
5+
# We're not hosting any application with usage of the dockers.
6+
AVD-DS-0026

0 commit comments

Comments
 (0)