I am testing the jenkins job-dsl plugin. I have an existing project where the setting 'Delete workspace before build starts' is enabled.
I have the following DSL defined:
job("$basePath/my-project") {
scm {
git {
remote {
name('origin')
url('[email protected]:my-organisation/my-project.git')
}
branch('*/develop')
extensions {
wipeOutWorkspace()
submoduleOptions {
recursive()
}
}
}
}
}
It seems this gives a configuration that is not really the same, it shows a "Wipe out repository & force clone" option. Are these options really the same thing in the end or are there different behaviours?
The plugin provides a build wrapper (Delete workspace before build starts) and a post build step (Delete workspace when build is done). These steps allow you to configure which files will be deleted and in what circumstances. The post build step can also take the build status into account.
Yes, you can delete the workspaces safely as well as jobs. The idea of the jobs directory is to allow you to display jobs history, if job history is not important for you then you can delete job directories from there.
There is a way to clean up a workspace in Jenkins. You need to install the Workspace Cleanup Plugin. This plugin can clean up the workspace before build or after a build. Under Build Environment, check the box that says Delete workspace before build starts.
Wipe out repository & force clone will clean the entire project workspace and clone the project once again before building. It could be time consuming depends on the project size. If the project is 1GB, it downloads 1GB everytime you build it.
There is in general no difference between both options.
They are provided by different plugins:
The main differences between the Workspace Clean Plugin and the Git Plugin:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With