`clean_git_config` deletes the template config for certain configurations
With %"18.0" we got the report that user see: ``` Running with gitlab-runner 18.0.2 (4d7093e1) Fetching changes with git depth set to 20... hint: Using 'master' as the name for the initial branch. This default branch name hint: is subject to change. To configure the initial branch name to use in all hint: of your new repositories, which will suppress this warning, call: hint: hint: git config --global init.defaultBranch <name> hint: hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and hint: 'development'. The just-created branch can be renamed via this command: hint: hint: git branch -m <name> Initialized empty Git repository in /builds/root/test/.git/ Created fresh repository. ``` with the kubernetes and docker executor. This is an side-effect of the git clean up running at the beginning of the job, but at the wrong time. This is the result of a combination of things that happened recently: 1. https://gitlab.com/gitlab-org/gitlab-runner/-/merge_requests/5438+ This was generally done, so that it's less likely for unintended/malicious configs to be cached. Note: - we've decided to do the cleanup also at the beginning of the build, and not only (as previously) at the end of the build - this is on by default for a couple of configs, off for others; see [here](https://gitlab.com/gitlab-org/gitlab-runner/-/merge_requests/5438/diffs#968cddea646e20e57b2edd3e8dc966cf4c268ab6_732_744) 1. https://gitlab.com/gitlab-org/gitlab-runner/-/merge_requests/5010+ This, besides implementing native git clone, abstracted the setup of the template dir 1. https://gitlab.com/gitlab-org/gitlab-runner/-/merge_requests/5525+ To support FF_GIT_URLS_WITHOUT_TOKENS also with native clone, some refactorings have been done, most prominently: pulling up the template dir setup so that it is reused for different GIT_STRATEGIES With 3. we are now in the situation that: - the template directory is set up correctly - however the config therein is, just before the `git init` call, deleted again because of `clean_git_config` - effectively disabling the template Potentially affected configs: - any executor except `shell` - when `clean_git_config` is not disabled via configuration - all gitlab runner version >= 18.0.0 Workaround: Until a proper fix is merged/released, affected users can set [`clean_git_config`](https://gitlab.com/gitlab-org/gitlab-runner/-/blob/1da69ed13189b4edc5fc05205118bdc17283e990/common/config.go#L1198) to `false` explicitly. Note: other things setup in the template are now also not effective anymore, see [here](https://gitlab.com/gitlab-org/gitlab-runner/-/blob/e84bcf0b9f6b6c1e324c7c4806cb227629c1972f/shells/abstract.go#L767). Proposed Fix: - Pull up the cleanup, similarly as we've pulled up the template dir setup in 3. - Ensure the cleanup works across different GIT_STRATEGYs (also native clone)
issue