Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jenkinsfile: Note/proposal to improve agent and cleanup settings #189

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
pipeline {

agent any

// When using the Jenkins pipeline where each stage runs on a different agent,
// it is good practice to use `agent none` at the beginning.
// https://stackoverflow.com/questions/44531003/how-to-use-post-steps-with-jenkins-pipeline-on-multiple-agents
// https://github.com/jenkinsci/pipeline-model-definition-plugin/wiki/Controlling-your-build-environment#3-i-like-to-drive-stick-get-out-of-my-way
//agent none

environment {
JDK_11 = '[email protected]'
}
Expand Down Expand Up @@ -229,9 +237,24 @@ pipeline {
}
}
}

// Clean up workspace.
post {
cleanup {
deleteDir() /* clean up our workspace */
deleteDir()
}
}

// Clean up workspace on any node.
// https://stackoverflow.com/questions/44531003/how-to-use-post-steps-with-jenkins-pipeline-on-multiple-agents
/*
post {
always {
node(null) {
deleteDir()
}
}
}
*/

}