Difference between 'Delete workspace before build starts' and 'Wipe out repository & force clone' in Jenkins?

Wim Deblauwe picture Wim Deblauwe · May 31, 2016 · Viewed 34.8k times · Source

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?

Answer

CSchulz picture CSchulz · May 31, 2016

There is in general no difference between both options.

They are provided by different plugins:

  • Wipe out repository & force clone is part of the Git Plugin and only suitable as extension of the git plugin
  • Delete workspace before build starts is part of the Workspace Clean Plugin

The main differences between the Workspace Clean Plugin and the Git Plugin:

  • Not bound to Git SCM only
  • Allows the usage of ant file pattern to delete only some files or directories