Clean Jenkins Workspace

Created by Tass Skoudros, Modified on Fri, 11 Nov 2022 at 09:48 AM by Tass Skoudros

Cleaning a workspace is an important housekeeping activity for your pipelines because we rarely overprovision storage so there is usually only enough space on an agent for a few builds. If the intention is that you want to resuse agents then we advise you to perform some housekeeping activities in your pipelines. To do this we leverage the post function in the Jenkins pipeline to execute tasks at the end of a pipeline. The post pipeline supports properties to enable you to run various activities based on the success of the pipeline. 

Clean Workspace

post {
 always {
   deleteDir()
 }
}

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article