-
Bug
-
Resolution: Fixed
-
Major
-
None
-
Jenkins and multi SCM plugin configured with git repository using submodules
Alternatively: A pipeline that checks out a second repository in a sub-dir
-
-
git-client-plugin 3.0.0, git-plugin 4.1.0
Submodules clean up
Jenkins SCM plugin can handle git repositories with submodules except for clean up.
When "Clean before checkout" is selected, it runs 'git reset --hard && git clean -dxf' on the repository and submodules if "Recursively update submodules" is selected. This works for most stuff but it does not work if git submodule is removed from the tree which leaves the submodule directory in workspace even after 'git clean -dxf'.
If another '-f' is added, also the removed submodule will be deleted which is the behavior I'd expect when git submodules are in use.
So Jenkins git plugin should call 'git clean -dxf -f' in that case.
Pipelines workspace reuse
An alternative use case, which I believe is very common, is that a pipeline checks out a repository in a sub-directory. Since the workspaces are reused between builds, there is a big risk that code or generated files in that sub-directory from previous builds are still there in the next run. This can seriously impact reliability of build or even fail them. One case is that old cucumber test reports are found.
Completely wiping the workspace has a performance cost that is unreasonable.
- is duplicated by
-
JENKINS-45705 Git clean before or after checkout should call git clean -ffdx (2 "f"s)
- Closed
- is related to
-
JENKINS-63383 Polluted workspace -- "Clean after checkout" (git clean -fdx) won't remove git repositories in subdirectories
- Closed
- links to