ci: more Jenkins fixes

This commit is contained in:
Stefan Reimer 2022-01-13 15:31:35 +01:00
parent d3a95d6e0d
commit 21361d6a12
3 changed files with 9 additions and 5 deletions

View File

@ -23,7 +23,7 @@ RUN mkdir -p /var/lib/shared/overlay-images /var/lib/shared/overlay-layers \
/var/lib/shared/vfs-images/images.lock /var/lib/shared/vfs-layers/layers.lock /var/lib/shared/vfs-images/images.lock /var/lib/shared/vfs-layers/layers.lock
# Trivy html template # Trivy html template
ADD --chown=jenkins:jenkins html.tpl /home/jenkins/agent ADD --chown=jenkins:jenkins html.tpl /home/jenkins
# Make docker in Jenkinsfiles work # Make docker in Jenkinsfiles work
RUN ln -s /usr/bin/podman /usr/bin/docker RUN ln -s /usr/bin/podman /usr/bin/docker

10
Jenkinsfile vendored
View File

@ -2,19 +2,21 @@ pipeline {
// agent { node { label 'podman && trivy && aws' } } // agent { node { label 'podman && trivy && aws' } }
agent { node { label 'podman' } } agent { node { label 'podman' } }
stages { stages {
// Build using rootless podman
stage('Build'){ stage('Build'){
steps { steps {
sh 'make build' sh 'make build'
} }
} }
// Scan via trivy
stage('Scan'){ stage('Scan'){
environment { environment {
TRIVY_TEMPLATE = "@${env.JENKINS_AGENT_WORKDIR}/html.tpl" TRIVY_TEMPLATE = "@${env.HOME}/html.tpl"
TRIVY_FORMAT = "template" TRIVY_FORMAT = "template"
TRIVY_OUTPUT = "reports/trivy.html" TRIVY_OUTPUT = "reports/trivy.html"
} }
steps { steps {
// Scan via trivy
sh 'mkdir -p reports' sh 'mkdir -p reports'
sh 'env' sh 'env'
sh 'make scan' sh 'make scan'
@ -33,9 +35,11 @@ pipeline {
sh 'TRIVY_EXIT_CODE=1 TRIVY_SEVERITY=CRITICAL make scan' sh 'TRIVY_EXIT_CODE=1 TRIVY_SEVERITY=CRITICAL make scan'
} }
} }
// Push to ECR
stage('Push'){ stage('Push'){
steps { steps {
sh 'echo make push' sh 'make push'
} }
} }
} }

View File

@ -1,4 +1,4 @@
VERSION ?= 0.1.0 VERSION ?= 0.1.1
BASE ?= latest-alpine-jdk11 BASE ?= latest-alpine-jdk11
REGISTRY := public.ecr.aws/zero-downtime REGISTRY := public.ecr.aws/zero-downtime
REPOSITORY := jenkins-podman REPOSITORY := jenkins-podman