There is a way to cleanup workspace in Jenkins. You can clean up the workspace before build or after build.
First, install Workspace Cleanup Plugin.
To clean up the workspace before build:
Under Build Environment, check the box that says Delete workspace before build starts.
To clean up the workspace after the build:
Under the heading Post-build Actions select Delete workspace when build is done from the Add Post-build Actions drop down menu.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…