From caf07e253a41239598b125eef9d3819b94130414 Mon Sep 17 00:00:00 2001 From: chris Date: Fri, 23 Oct 2020 19:53:15 +0200 Subject: [PATCH] manage artifacts --- Jenkinsfile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index a92d7aa..0350818 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -9,7 +9,7 @@ pipeline { steps { withDockerRegistry([ credentialsId: "6ff44976-23cd-4cc2-902c-de8c340e65e5", url: "https://reg.zknt.org" ]) { script { - def customImage = docker.build("reg.zknt.org/zknt/debian", "--build-arg DATE=$timeStamp --build-arg GOSU_VERSION=$gosu_version --build-arg DUMB_INIT_VERSION=$dumb_init_version --no-cache --pull .") + def customImage = docker.build("reg.zknt.org/zknt/debian", "--pull --build-arg DATE=$timeStamp --build-arg GOSU_VERSION=$gosu_version --build-arg DUMB_INIT_VERSION=$dumb_init_version --no-cache .") customImage.push("buster") customImage.push("stable") customImage.push("10") @@ -26,6 +26,10 @@ pipeline { } } post { + success { + sh """docker rmi -f \$(docker images -q $registry/$repo/$project:$version)""" + sh """for image in \$(grep FROM Dockerfile | cut -d ' ' -f 2); do docker rmi -f \$(docker images -q \${image}); done""" + } always { emailext body: 'build finished', subject: '[jenkins] docker debian: ' + currentBuild.result, to: 'cg@zknt.org', from: 'sysadm@zknt.org', attachLog: true }