Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Infrastructure GitOps
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Operate
Terraform modules
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Shivering-Isles
Infrastructure GitOps
Commits
f25719f6
Verified
Commit
f25719f6
authored
2 years ago
by
Sheogorath
Browse files
Options
Downloads
Patches
Plain Diff
ci(trivy): Add trivy scan for all container images
parent
1f336dea
No related branches found
No related tags found
1 merge request
!538
ci(trivy): Add trivy scan for all container images
Pipeline
#16842
failed
2 years ago
Stage: build
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitlab-ci.yml
+1
-0
1 addition, 0 deletions
.gitlab-ci.yml
images/.utils/gitlab-ci.yaml
+48
-0
48 additions, 0 deletions
images/.utils/gitlab-ci.yaml
with
49 additions
and
0 deletions
.gitlab-ci.yml
+
1
−
0
View file @
f25719f6
...
@@ -5,6 +5,7 @@ include:
...
@@ -5,6 +5,7 @@ include:
stages
:
stages
:
-
lint
-
lint
-
build
-
build
-
test
-
changelog
-
changelog
-
release
-
release
...
...
This diff is collapsed.
Click to expand it.
images/.utils/gitlab-ci.yaml
+
48
−
0
View file @
f25719f6
...
@@ -67,3 +67,51 @@ container-build-dev:
...
@@ -67,3 +67,51 @@ container-build-dev:
compare_to
:
main
compare_to
:
main
tags
:
tags
:
-
hetzner
-
hetzner
stages
:
-
test
container-trivy-scan
:
stage
:
test
extends
:
.container-matrix
image
:
name
:
docker.io/aquasec/trivy:0.37.3
entrypoint
:
[]
services
:
-
name
:
docker:dind
entrypoint
:
[
"
env"
,
"
-u"
,
"
DOCKER_HOST"
]
command
:
[
"
dockerd-entrypoint.sh"
]
variables
:
DOCKER_HOST
:
tcp://docker:2375/
DOCKER_DRIVER
:
overlay2
# See https://github.com/docker-library/docker/pull/166
DOCKER_TLS_CERTDIR
:
"
"
IMAGE
:
"
quay.io/shivering-isles/${IMAGE}:${CI_COMMIT_SHORT_SHA}"
TRIVY_NO_PROGRESS
:
"
true"
TRIVY_CACHE_DIR
:
"
.trivycache/"
allow_failure
:
true
script
:
# Image report
-
trivy image --exit-code 0 --format template --template "@contrib/gitlab-codequality.tpl" -o gl-codeclimate-image.json $IMAGE
# Filesystem report
-
trivy filesystem --scanners config,vuln --exit-code 0 --format template --template "@contrib/gitlab-codequality.tpl" -o gl-codeclimate-fs.json .
# Combine report
-
apk update && apk add jq
-
jq -s 'add' gl-codeclimate-image.json gl-codeclimate-fs.json > gl-codeclimate.json
cache
:
paths
:
-
.trivycache/
artifacts
:
paths
:
-
gl-codeclimate.json
reports
:
codequality
:
gl-codeclimate.json
rules
:
-
if
:
'
$CI_COMMIT_BRANCH
!=
$CI_DEFAULT_BRANCH
&&
$CI_PIPELINE_SOURCE
==
"push"'
changes
:
paths
:
-
images/${IMAGE}/**/*
-
images/.utils/*
compare_to
:
main
tags
:
-
hetzner
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment