Jenkins Pipeline Wipe Out Workspace

前端 未结 13 1490
你的背包
你的背包 2020-12-04 08:59

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

13条回答
  •  孤街浪徒
    2020-12-04 09:41

    Cleaning up : Since the post section of a Pipeline is guaranteed to run at the end of a Pipeline’s execution, we can add some notification or other steps to perform finalization, notification, or other end-of-Pipeline tasks.

    pipeline {
        agent any
        stages {
            stage('No-op') {
                steps {
                    sh 'ls'
                }
            }
        }
        post {
            cleanup {
                echo 'One way or another, I have finished'
                deleteDir() /* clean up our workspace */
            }
        }
    }
    

提交回复
热议问题