Add Trivy scanner stage #4

Merged
erichardson merged 7 commits from add-trivy-scanner into master 2021-05-09 02:37:52 +00:00
Showing only changes of commit 08506cc1b6 - Show all commits

View File

@@ -127,11 +127,11 @@ trivy:
# Build image
- docker build -t $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA ./Docker/
# Build report
- ./trivy image --exit-code 0 --cache-dir .trivycache/ --no-progress --format template --template "@contrib/gitlab.tpl" -o gl-container-scanning-report.json $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
- ./trivy --exit-code 0 --cache-dir .trivycache/ --no-progress --format template --template "@contrib/gitlab.tpl" -o gl-container-scanning-report.json image $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
# Print report
- ./trivy image --exit-code 0 --cache-dir .trivycache/ --no-progress --severity HIGH $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
- ./trivy --exit-code 0 --cache-dir .trivycache/ --no-progress --severity HIGH image $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
# Fail on severe vulnerabilities
- ./trivy image --exit-code 1 --cache-dir .trivycache/ --severity CRITICAL --no-progress $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
- ./trivy --exit-code 1 --cache-dir .trivycache/ --severity CRITICAL --no-progress image $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
cache:
paths:
- .trivycache/