From 90c5bf63547f55f70eb4ebac6557094075b1a1f1 Mon Sep 17 00:00:00 2001 From: Elia el Lazkani Date: Mon, 3 Jul 2023 00:18:50 +0200 Subject: [PATCH] fix(): Migrates the image to DinD --- .drone.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.drone.yml b/.drone.yml index 91e7deb..8224cbe 100644 --- a/.drone.yml +++ b/.drone.yml @@ -38,21 +38,25 @@ steps: repo: scm.project42.io/elia/blog dry_run: true squash: true - purge: false tags: - "${DRONE_COMMIT_SHA:0:8}" depends_on: - clean-up-images - name: trivy-scan - image: docker.io/aquasec/trivy:latest + image: docker:dind volumes: - name: dockersock path: /var/run/docker.sock commands: + - export TRIVY_VERSION=$(wget -qO - "https://api.github.com/repos/aquasecurity/trivy/releases/latest" | grep '"tag_name":' | sed -E 's/.*"v([^"]+)".*/\1/') + - echo "$TRIVY_VERSION" + - export TRIVY_URL=$(printf "https://github.com/aquasecurity/trivy/releases/download/v%s/trivy_%s_Linux-64bit.tar.gz" "$TRIVY_VERSION" "$TRIVY_VERSION") + - echo "$TRIVY_URL" + - wget --no-verbose "$TRIVY_URL" -O - | tar -zxvf - - docker build -t "scm.project42.io/elia/blog:${DRONE_COMMIT_SHA:0:8}" . - - trivy image --exit-code 0 "scm.project42.io/elia/blog:${DRONE_COMMIT_SHA:0:8}" - - trivy image --exit-code 1 --severity CRITICAL "scm.project42.io/elia/blog:${DRONE_COMMIT_SHA:0:8}" + - ./trivy image --exit-code 0 "scm.project42.io/elia/blog:${DRONE_COMMIT_SHA:0:8}" + - ./trivy image --exit-code 1 --severity CRITICAL "scm.project42.io/elia/blog:${DRONE_COMMIT_SHA:0:8}" - docker rmi "scm.project42.io/elia/blog:${DRONE_COMMIT_SHA:0:8}" depends_on: - test-build-container