fix: trivy execution

This commit is contained in:
2022-08-27 12:35:26 +02:00
parent 9437fb2878
commit 6812a952b8
+5 -5
View File
@@ -44,7 +44,7 @@ dev_deploy:
before_script:
- base64 -d $SA_Development | docker login -u _json_key --password-stdin https://eu.gcr.io
stage: docker
script:
script:
- docker build -t $IMAGE_TAG .
- docker push $IMAGE_TAG
only:
@@ -68,14 +68,14 @@ dev_trivy:
# cache cleanup is needed when scanning images with the same tags, it does not remove the database
- time trivy image --clear-cache
# update vulnerabilities db
- time trivy --download-db-only --no-progress --cache-dir .trivycache/
# - time trivy --download-db-only --no-progress --cache-dir .trivycache/
# Builds report and puts it in the default workdir $CI_PROJECT_DIR, so `artifacts:` can take it from there
- time trivy --exit-code 0 --cache-dir .trivycache/ --no-progress --format template --template "@/contrib/gitlab.tpl"
--output "$CI_PROJECT_DIR/gl-container-scanning-report.json" "$FULL_IMAGE_NAME"
--output "$CI_PROJECT_DIR/gl-container-scanning-report.json" image "$FULL_IMAGE_NAME"
# Prints full report
- time trivy --exit-code 0 --cache-dir .trivycache/ --no-progress "$FULL_IMAGE_NAME"
- time trivy --exit-code 0 --cache-dir .trivycache/ --no-progress image "$FULL_IMAGE_NAME"
# Fail on critical vulnerabilities
- time trivy --exit-code 1 --cache-dir .trivycache/ --severity CRITICAL --no-progress "$FULL_IMAGE_NAME"
- time trivy --exit-code 1 --cache-dir .trivycache/ --severity CRITICAL --no-progress image "$FULL_IMAGE_NAME"
cache:
paths:
- .trivycache/