Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 916
Wim Deblauwe Avatar asked May 31 '16 08:05

Wim Deblauwe


People also ask

What is delete workspace before build starts?

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.

Is it safe to delete workspace in Jenkins?

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.

What is wipe out current workspace in Jenkins?

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.

What is wipe out Repository & force clone?

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.


1 Answers

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
like image 54
CSchulz Avatar answered Oct 12 '22 18:10

CSchulz