-
Notifications
You must be signed in to change notification settings - Fork 122
Jenkins Image cleanup #4779
Comments
I really like the idea of having a proper post section and cleaning everything up that is produced during the pipeline on the agents. |
diff --git a/scripts/jenkins/Jenkinsfile b/scripts/jenkins/Jenkinsfile
index fbb23a3eb..e5dcf1e53 100644
--- a/scripts/jenkins/Jenkinsfile
+++ b/scripts/jenkins/Jenkinsfile
@@ -207,6 +207,10 @@ Logs: ${currentBuild.rawBuild.getLog(20).join('\n')}
to: "[email protected]"
}
throw e
+} finally {
+ stage("cleanup") {
+ sh "docker image list --format='{{ .Repository }}' '*:${dockerUtils.tagArtifact()}' | xargs docker image rm"
+ }
}
/***************************************************************************** I think this might actually do the trick. It should add a |
I mark this stale as it did not have any activity for one year. I'll close it in two weeks if no further activity occurs. If you want it to be alive again, ping by writing a message here or create a new issue with the remainder of this issue. |
I closed this now because it has been inactive for more than one year. If I closed it by mistake, please do not hesitate to reopen it or create a new issue with the remainder of this issue. |
Based on the discoveries from the last meeting and the recent troubles with disk space (see #160) I propose we do more immediate cleanup in the Jenkins pipeline.
Currently, we directly build a lot of images in the last stage of the pipeline:
libelektra/scripts/jenkins/Jenkinsfile
Lines 1104 to 1169 in 90f7081
Each of these
buildPackage
calls does adockerUtils.buildImage
call (which executesdocker build
):libelektra/scripts/jenkins/Jenkinsfile
Lines 1216 to 1229 in 90f7081
Additionally, there are few
dockerUtils.buildImageStage
(a wrapper arounddockerUtils.buildImage
) calls for the website and web-ui:libelektra/scripts/jenkins/Jenkinsfile
Line 749 in 90f7081
libelektra/scripts/jenkins/Jenkinsfile
Lines 1334 to 1338 in 90f7081
libelektra/scripts/jenkins/Jenkinsfile
Lines 1359 to 1364 in 90f7081
It makes sense to build those images to test, if the build works, but there is no need to keep images around. AFAICT, if the pipeline isn't running on
master
the images aren't even published anywhere.So I propose we add a
dockerUtils.removeImage
in ElektraInitiative/jenkins-library to executedocker image rm
. Then we calldockerUtils.removeImage
either as soon as the images aren't needed anymore, or even better, we add apost
section to the pipeline for proper cleanup.The text was updated successfully, but these errors were encountered: