CI: Add cleanWs to cleanup steps in jenkinsfiles

We're at the point where there are enough Jenkins jobs for
Asterisk branches than even cleaned checkouts of Asterisk
will add up to more disk space than is available on the
in-memory workspace mount.  Since we archive all relevent
artifacts anyway, there's no need to keep the workspace
around after the job finishes, whether it succeeds or fails.

Change-Id: I1cd3b73ebb045a987df0f62526d152a510210c39
This commit is contained in:
George Joseph
2019-07-19 10:20:38 -06:00
parent 51b1111eaf
commit b63425f469
4 changed files with 11 additions and 15 deletions

View File

@@ -54,7 +54,7 @@ pipeline {
onUnstable: false onUnstable: false
] ]
} }
agent { agent {
/* All of the stages need to be performed on a docker host */ /* All of the stages need to be performed on a docker host */
label "swdev-docker" label "swdev-docker"
@@ -78,9 +78,9 @@ pipeline {
manager.createSummary("/plugin/workflow-job/images/48x48/pipelinejob.png").appendText("Docker Host: ${NODE_NAME}", false) manager.createSummary("/plugin/workflow-job/images/48x48/pipelinejob.png").appendText("Docker Host: ${NODE_NAME}", false)
stage ("Checkout") { stage ("Checkout") {
sh "sudo chown -R jenkins:users ." sh "sudo chown -R jenkins:users ."
env.GERRIT_PROJECT_URL = env.GIT_URL.replaceAll(/[^\/]+$/, env.GERRIT_PROJECT) env.GERRIT_PROJECT_URL = env.GIT_URL.replaceAll(/[^\/]+$/, env.GERRIT_PROJECT)
/* /*
* Jenkins has already automatically checked out the base branch * Jenkins has already automatically checked out the base branch
* for this change but we now need to check out the change itself * for this change but we now need to check out the change itself
@@ -191,7 +191,7 @@ pipeline {
} }
sh "sudo rm -rf ${groupDir} || : " sh "sudo rm -rf ${groupDir} || : "
withCredentials([usernamePassword(credentialsId: "${JENKINS_GERRIT_CREDS}", withCredentials([usernamePassword(credentialsId: "${JENKINS_GERRIT_CREDS}",
passwordVariable: 'GERRIT_USER_PW', usernameVariable: 'GERRIT_USER_NAME')]) { passwordVariable: 'GERRIT_USER_PW', usernameVariable: 'GERRIT_USER_NAME')]) {
checkout scm: [$class: 'GitSCM', checkout scm: [$class: 'GitSCM',
@@ -237,8 +237,7 @@ pipeline {
} }
post { post {
cleanup { cleanup {
sh "sudo make distclean >/dev/null 2>&1 || : " cleanWs deleteDirs: true, notFailBuild: true
sh "sudo rm -rf tests/CI/output >/dev/null 2>&1 || : "
} }
/* /*
* The Gerrit Trigger will automatically post the "Verified" results back * The Gerrit Trigger will automatically post the "Verified" results back

View File

@@ -157,8 +157,7 @@ pipeline {
} }
post { post {
cleanup { cleanup {
sh "sudo make distclean >/dev/null 2>&1 || : " cleanWs deleteDirs: true, notFailBuild: true
sh "sudo rm -rf tests/CI/output >/dev/null 2>&1 || : "
} }
success { success {
echo "Reporting ${currentBuild.currentResult} Passed" echo "Reporting ${currentBuild.currentResult} Passed"

View File

@@ -26,7 +26,7 @@ pipeline {
triggers { triggers {
cron 'H H(0-4) * * 0' cron 'H H(0-4) * * 0'
} }
agent { agent {
/* All of the stages need to be performed on a docker host */ /* All of the stages need to be performed on a docker host */
label "swdev-docker" label "swdev-docker"
@@ -40,7 +40,7 @@ pipeline {
manager.createSummary("/plugin/workflow-job/images/48x48/pipelinejob.png").appendText("Docker Host: ${NODE_NAME}", false) manager.createSummary("/plugin/workflow-job/images/48x48/pipelinejob.png").appendText("Docker Host: ${NODE_NAME}", false)
stage ("Checkout") { stage ("Checkout") {
sh "sudo chown -R jenkins:users ." sh "sudo chown -R jenkins:users ."
sh "printenv | sort" sh "printenv | sort"
sh "sudo tests/CI/setupJenkinsEnvironment.sh" sh "sudo tests/CI/setupJenkinsEnvironment.sh"
} }
@@ -93,7 +93,7 @@ pipeline {
} }
sh "sudo rm -rf ${groupDir} || : " sh "sudo rm -rf ${groupDir} || : "
checkout scm: [$class: 'GitSCM', checkout scm: [$class: 'GitSCM',
branches: [[name: "${BRANCH_NAME}"]], branches: [[name: "${BRANCH_NAME}"]],
extensions: [ extensions: [
@@ -127,8 +127,7 @@ pipeline {
} }
post { post {
cleanup { cleanup {
sh "sudo make distclean >/dev/null 2>&1 || : " cleanWs deleteDirs: true, notFailBuild: true
sh "sudo rm -rf tests/CI/output >/dev/null 2>&1 || : "
} }
success { success {
echo "Reporting ${currentBuild.currentResult} Passed" echo "Reporting ${currentBuild.currentResult} Passed"

View File

@@ -181,8 +181,7 @@ pipeline {
} }
post { post {
cleanup { cleanup {
sh "sudo make distclean >/dev/null 2>&1 || : " cleanWs deleteDirs: true, notFailBuild: true
sh "sudo rm -rf tests/CI/output >/dev/null 2>&1 || : "
} }
/* /*
* The Gerrit Trigger will automatically post the "Verified" results back * The Gerrit Trigger will automatically post the "Verified" results back