From ec564ae510ba4845bcbe62a7f48391a5337526fb Mon Sep 17 00:00:00 2001 From: Stefan Reimer Date: Thu, 3 Feb 2022 19:29:47 +0100 Subject: [PATCH] feat: Add yq --- Dockerfile | 1 + Jenkinsfile | 7 ++++--- Makefile | 2 ++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 78bf0ef..475a988 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,6 +8,7 @@ RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/reposit && apk --no-cache add \ tini \ make \ + yq \ fuse-overlayfs \ podman \ buildah \ diff --git a/Jenkinsfile b/Jenkinsfile index a0fee82..98df856 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,9 +1,10 @@ pipeline { agent { node { label 'podman-aws-trivy' } } + stages { stage('Prepare'){ + // get tags steps { - // get tags sh 'git fetch --tags ${GIT_URL} +refs/heads/${BRANCH_NAME}:refs/remotes/origin/${BRANCH_NAME}' } } @@ -24,8 +25,8 @@ pipeline { // Scan via trivy stage('Scan'){ environment { - TRIVY_FORMAT = "template" - TRIVY_OUTPUT = "reports/trivy.html" + TRIVY_FORMAT = "template" + TRIVY_OUTPUT = "reports/trivy.html" } steps { sh 'mkdir -p reports' diff --git a/Makefile b/Makefile index 30c6ac0..0de5792 100644 --- a/Makefile +++ b/Makefile @@ -24,6 +24,8 @@ push: podman tag $(REPOSITORY):latest $(REGISTRY)/$(REPOSITORY):$(TAG) $(REGISTRY)/$(REPOSITORY):latest podman push $(REGISTRY)/$(REPOSITORY):$(TAG) podman push $(REGISTRY)/$(REPOSITORY):latest + # Delete all untagged images + # aws ecr-public batch-delete-image --repository-name $(REPOSITORY) --region $(REGION) --image-ids $$(for image in $$(aws ecr-public describe-images --repository-name $(REPOSITORY) --region $(REGION) --output json | jq -r '.imageDetails[] | select(.imageTags | not ).imageDigest'); do echo -n "imageDigest=$$image "; done) scan: trivy $(TRIVY_OPTS) $(REPOSITORY):$(TAG)