[workflow-plugin] Clean workspace

179 views
Skip to first unread message

Daniel P

unread,
Mar 3, 2015, 9:18:26 AM3/3/15
to jenkins...@googlegroups.com
Hi,

Is there something similar in workflow to the "Workspace Cleanup Plugin" we could use to make sure no old files are left in a workspace?
Or are we forced to use something like "sh 'rm -r *'" every time we allocate a node?


Regards,
Daniel

Jesse Glick

unread,
Mar 19, 2015, 11:26:52 AM3/19/15
to jenkins...@googlegroups.com
On Tuesday, March 3, 2015 at 9:18:26 AM UTC-5, Daniel P wrote:
Or are we forced to use something like "sh 'rm -r *'" every time we allocate a node?

“sh 'rm -rf *'” is shorter than even the name “Workspace Cleanup Plugin”. :-)

Thomas Gimpel

unread,
Aug 15, 2015, 4:33:03 AM8/15/15
to Jenkins Users
This does not work on a Windows node. One has to use a batch script like this
rmdir /s /q %cd% 2>null& exit /b 0
Unfortunately jenkins seems to put that batch script itself into the workspace folder (besides some log files). Thus executing the mentioned batch file deletes that file itself and the command interpreter fails with "The batch file cannot be found.". After that the jenkins job hangs forever. So again, is there simple common way to cleanup the workspace?
Reply all
Reply to author
Forward
0 new messages