We use docker containers to build all jobs. So we don't have to worry about cleanup workspace, as container goes away with it. But I see $JENKINS_HOME/workspace/_job_name_PR-251-4MSWSIVZHFONFLOHNITFTR6R5CAJMNKESIVZHFONFLOHNITFTR6@script I tried below but did not cleanup
pipeline {
agent {
label 'jenkins-slave'
}
stages {
stage('Build') {
steps {
sh '''npm install
npm run build'''
}
}
}
post { cleanup { cleanWs() } }
}
I can have nightly jenkins job or cron job to delete those directories, looking for better way.