gilde-ci-cd/templates/container/container-scan.gitlab-ci.yml

20 lines
753 B
YAML

.container-scan-trivy:
image:
name: docker.io/aquasec/trivy:0.30.3
entrypoint: [ "" ]
stage: verify
variables:
IMAGE_PATH: $CI_PROJECT_DIR/image.tar
EXITCODE: 1
TRIVY_EXTRA_ARGS: "--no-progress --ignore-unfixed --severity HIGH,CRITICAL --input image.tar"
cache:
paths:
- .trivycache/
artifacts:
reports:
junit: junit-report.xml
script:
# Builds report and puts it in the default workdir $CI_PROJECT_DIR, so artifacts: can take it from there
- trivy --cache-dir .trivycache/ image --timeout 15m $TRIVY_EXTRA_ARGS --exit-code 0 --format template --template "/contrib/junit.tpl" -o junit-report.xml
- trivy --cache-dir .trivycache/ image --timeout 15m $TRIVY_EXTRA_ARGS --exit-code $EXITCODE