Jenkins Pipeline Wipe Out Workspace

前端 未结 13 1430
你的背包
你的背包 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:35

    In my case, I want to clear out old files at the beginning of the build, but this is problematic since the source code has been checked out.

    My solution is to ask git to clean out any files (from the last build) that it doesn't know about:

        sh "git clean -x -f"
    

    That way I can start the build out clean, and if it fails, the workspace isn't cleaned out and therefore easily debuggable.

提交回复
热议问题