Search code examples
jenkinscontinuous-integrationjenkins-pipelinejenkins-pluginsworkspace

Jenkins Pipeline Wipe Out Workspace


We are running Jenkins 2.x and love the new Pipeline plugin. However, with so many branches in a repository, disk space fills up quickly.

Is there any plugin that's compatible with Pipeline that I can wipe out the workspace on a successful build?


Solution

  • You can use deleteDir() as the last step of the pipeline Jenkinsfile (assuming you didn't change the working directory).