Skip to content

git checkouts files with mixed line ending for windows docker

Summary

gitlab runner started to checkout repository with mixed line endings on windows with docker-windows executor since 17.8.2

Steps to reproduce

This is private repository and no info can be provided.

Actual behavior

Some files from same repository are checked out with LF endings and some with CRLF.

Expected behavior

All files should be checked out with CRLF endings, since checkout is happening in windows runner.

Environment description

It's a custom installation. All configurations are the same for both runners. Only change is using different gitlab-runner.exe
When runner 17.7.1 is used, all files are checked out with CRLF endings
When runner 17.8.2 is used, some files are checked out with LF endings and some with CRLF.

Couldn't test 17.8.0 and 17.8.1 since powershell was missing in these versions and checkout was not working.

We don't have .gitattributes file in repository, so git can decide which line endings to use.
Up until (and including) runner version 17.7.1 everything was working OK.
All files were being checked out with CRLF endings.

Tried today 17.9.2, still get same result with mixed endings.

Executor: docker-windows

Used GitLab Runner version

gitlab runner 17.7.1 log
Running with gitlab-runner 17.7.1 (6669abcf)
  on docker-runner-sauliusz t3_DkZcGs, system ID: s_cdf396c5c9cf
Preparing the "docker-windows" executor 00:15
Using Docker executor with image HIDDEN ...
Pulling docker image HIDDEN ...
Using docker image sha256:1b3f9651c54cb2bfdd0e78c90198b7023f579c608342cd3dabeee66e0cfb5b23 for HIDDEN with digest HIDDEN ...
Preparing environment 00:05
Running on RUNNER-T3DKZCGS via 
hidden...
Getting source from Git repository 00:37
Fetching changes with git depth set to 1...
Initialized empty Git repository in C:/builds/hidden/hidden/.git/
Created fresh repository.
Checking out 466185d2 as detached HEAD (ref is test_new_runner)...
git-lfs/3.5.1 (GitHub; windows amd64; go 1.21.7; git e237bb3a)
Skipping Git submodules setup
Executing "step_script" stage of the job script
gitlab runner 17.8.2 log
Running with gitlab-runner 17.8.2 (f9c5437e)
  on docker-runner-sauliusz t3_DkZcGs, system ID: s_cdf396c5c9cf
Preparing the "docker-windows" executor 00:15
Using Docker executor with image HIDDEN ...
Pulling docker image HIDDEN ...
Using docker image sha256:1b3f9651c54cb2bfdd0e78c90198b7023f579c608342cd3dabeee66e0cfb5b23 for HIDDEN with digest HIDDEN ...
Preparing environment 00:06
Running on RUNNER-T3DKZCGS via 
hidden...
Getting source from Git repository 00:35
Fetching changes with git depth set to 1...
Initialized empty Git repository in C:/builds/hidden/hidden/.git/
Created fresh repository.
Checking out 466185d2 as detached HEAD (ref is test_new_runner)...
git-lfs/3.5.1 (GitHub; windows amd64; go 1.21.7; git e237bb3a)
Skipping Git submodules setup
Executing "step_script" stage of the job script

Additional details

Everything described is related to docker-windows executor. Using on prem gitlab instance.

Files are checked out using setting clone with depth set to 1

Expectation is that all files should be with CRLF since this runner is based on windows, and windows by default uses CRLF. When repository is locally checked out all files are with CRLF endings as expected.

Maybe someone could give insights what has changed between 17.7.1 and 17.8.2 to mess up line endings ?