Skip to content

If GIT_CLEAN_FLAGS=none, skip clean for submodules as well

June Rhodes requested to merge hachque/gitlab-runner:master into main

What does this MR do?

This skips the git clean step for submodules if GIT_CLEAN_FLAGS=none with GIT_SUBMODULE_STRATEGY=recursive (or normal).

Why was this MR needed?

Without this change, the GitLab runner will clean artifacts out of all submodules recursively which can make builds take a lot longer (especially if you're already trying to set GIT_CLEAN_FLAGS=none to avoid unnecessary rebuilding of artifacts).

What's the best way to test this MR?

Set up a repository with GIT_CLEAN_FLAGS=none, GIT_SUBMODULE_STRATEGY=recursive and a Git submodule (can be anything really). Make a build process that writes a file into the submodule's folder. If the file does not get cleaned out next time the build runs, then the MR works.

I am already using this change in production and it is working as expected.

Edited by June Rhodes

Merge request reports