Add Trivy scanner stage #4
@@ -115,7 +115,6 @@ sonarqube-check:
|
|||||||
|
|
||||||
trivy:
|
trivy:
|
||||||
stage: test
|
stage: test
|
||||||
image: docker:stable
|
|
||||||
extends:
|
extends:
|
||||||
- .docker_base
|
- .docker_base
|
||||||
before_script:
|
before_script:
|
||||||
@@ -127,9 +126,9 @@ trivy:
|
|||||||
# Build image
|
# Build image
|
||||||
- docker build -t $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA ./Docker/
|
- docker build -t $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA ./Docker/
|
||||||
# Build report
|
# Build report
|
||||||
- ./trivy --exit-code 0 --cache-dir .trivycache/ --no-progress --format template --template "@contrib/gitlab.tpl" -o gl-container-scanning-report.json image python:3.4-alpine
|
- ./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
|
# Print report
|
||||||
- ./trivy --exit-code 0 --cache-dir .trivycache/ --no-progress --severity HIGH image python:3.4-alpine
|
- ./trivy --exit-code 0 --cache-dir .trivycache/ --no-progress --severity HIGH image $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
|
||||||
# Fail on severe vulnerabilities
|
# Fail on severe vulnerabilities
|
||||||
- ./trivy --exit-code 1 --cache-dir .trivycache/ --severity CRITICAL --no-progress image $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:
|
cache:
|
||||||
|
|||||||
Reference in New Issue
Block a user