How do I cleanup the workspace declaratively? I’m not using any jenkinsfile and it’s not a pipeline. Thanks.
Darin Pope provides a 15 minute video that reviews alternatives to delete build history in case that is what you mean by “cleanup the workspace declaratively”.
If you mean something different, please explain in more detail what you mean by “cleanup the workspace declaratively”.
Sorry, I did not make it clear. My freestyle project checks out the code in the below dir when I kick off a build. Once the build job is done, I’d like to clear the contents in the workspace directory.
I have a c:\jenkins\workspace directory in the slave machine.
there’s a checkbox on the top of freestyle jobs that says cleanup workspace before/after/etc
assuming you have the cleanup workspace plugin installed.
There is an option “Delete workspace before build starts” checkbox. Does this option wipe out everything under c:\jenkins\workspace directory? I’d like to keep some config files which are not part of the code repository. I’d like to delete only the files checked out by Jenkins.
For freestyle jobs there is a post build step “Delete workspace when build is done” provided by the workspace cleanup plugin
Here you can define exactly what should be deleted and under which conditions (success, failure, …).