Skip to content

Commit d266b41

Browse files
committed
chore(jenkins): clean up custom workspace directories
1 parent 638d011 commit d266b41

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

.jenkins.groovy

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,16 @@ Check console output at "<a href="${env.BUILD_URL}">${env.JOB_NAME} [${env.BRANC
202202
// (in this case we probably don't have to do any post-build analysis)
203203
cleanBeforeCheckout()
204204
script {
205+
// remove MatrixCheckout directories older than 30 days to save disk space
206+
sh '''
207+
set -eu
208+
base_dir="../../../.."
209+
if [ -d "$base_dir" ]; then
210+
find "$base_dir" -name MatrixCheckout -mindepth 3 -maxdepth 3 -type d -mtime +30 -exec rm -rf {} +
211+
fi
212+
'''
213+
214+
// If this build was successful, and the previous build was not successful, send a "back to normal" email.
205215
if (deployableBranch
206216
&& (currentBuild.previousBuild != null) && (currentBuild.previousBuild.result != 'SUCCESS')) {
207217
emailext(

0 commit comments

Comments
 (0)