What I want to achieve
I’m trying to setup a local GitLab runner to speed up my ability to debug and develop pipelines. I’ve installed GitLab runner and set up the runner. When I run a job, the runner picks it up but fails early on while setting up the environment.
I’m on windows 11.
How it started.
I’ve downloaded the windows binaries and installed the runner in C:Program FilesGitlabRunner
In PowerShell I run: ./gitlab-runner.exe register --tls-ca-file ./certificate.domain.com
And when prompted I enter my Gitlab instance URL, my registration token from the project… The command works fine and build the config.toml
which I edit by making sure: executor="shell"
and shell="bash"
. At this point I can also confirm the tls-ca-file
tag points to the right file.
Note that the runner does pick up the task successfully when I run a job from the website.
By this point I get the following error when running a job:
Running with gitlab-runner 17.0.0 (44fecc##)
on PROJECT Runner tb7goqB##, system ID: s_94a28c944d##
Resolving secrets
Preparing the "shell" executor
00:00
Using Shell (bash) executor...
Preparing environment
00:00
Running on ORG-USERNAME...
Getting source from Git repository
00:01
/usr/bin/bash: line 49: /c/Program Files/GitlabRunner/C:/Program Files/GitlabRunner/builds/tb7goqB##/0/GROUP_NAME/PROJECT_NAME.tmp/CI_SERVER_TLS_CA_FILE: No such file or directory
Cleaning up project directory and file based variables
00:00
ERROR: Job failed: exit status 1
Notice how it is looking for the TLS_CA file in:
/c/Program Files/GitlabRunner/C:/Program Files/GitlabRunner/builds/tb7goqB##/0/GROUP_NAME/PROJECT_NAME.tmp/CI_SERVER_TLS_CA_FILE
It re-references C:
Attempted Solution:
I’ve followed the following threads on the gitlab issue board:
https://gitlab.com/gitlab-org/gitlab-runner/-/issues/1283 (this one is particularly relevant)
https://gitlab.com/gitlab-org/gitlab-runner/-/issues/2859
https://gitlab.com/gitlab-org/gitlab-runner/-/issues/37328
https://gitlab.com/gitlab-org/gitlab-runner/-/issues/1233
And implemented the following fix:
I created the following folder structure:
C:Program FilesGitlabRunnerC:Program Files
Inside of which I added a symbolic link back to GitlabRunner to enable the following link: (--> Symbolic Link -->
is just to show you where the link is.)
/c/Program Files/GitlabRunner/C:/Program Files/--> Symbolic Link -->GitlabRunner/builds/tb7goqB##/0/GROUP_NAME/PROJECT_NAME.tmp/CI_SERVER_TLS_CA_FILE
Following all these recommendations now I have the following files:
> cd C:Program FilesGitlabRunnerCProgram FilesGitlabRunnerbuildstb7goqB##GROUP_NAME
> ls
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 5/17/2024 12:12 PM PROJECT_NAME
d----- 5/17/2024 12:17 PM PROJECT_NAME.tmp
> cd PROJECT_NAME.tmp
> ls
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 5/17/2024 12:21 PM git-template
-a---- 5/17/2024 12:21 PM 2796 CI_SERVER_TLS_CA_FILE
-a---- 5/17/2024 11:28 AM 2796 CI_SERVER_TLS_CA_FILE.com
-a---- 5/17/2024 12:21 PM 0 gitlab_runner_env
<also includes hidden .git folder>
> cd ../PROJECT_NAME
> ls
<empty except for .git folder>
Result
And yet when running the job I get the following error:
Running with gitlab-runner 17.0.0 (44fecc##)
on PROJECT Runner tb7goqB##, system ID: s_94a28c944d##
Resolving secrets
Preparing the "shell" executor
00:00
Using Shell (bash) executor...
Preparing environment
00:00
Running on ORG-USERNAME...
Getting source from Git repository
00:00
Fetching changes with git depth set to 20...
Reinitialized existing Git repository in C:/Program Files/GitlabRunner/builds/tb7goqB##/0/GROUP_NAME/PROJECT_NAME/.git/
fatal: unable to access 'https://git.ORG.com/GROUP_NAME/PROJECT_NAME.git/': error setting certificate file: C:Program FilesGitlabRunnerC;C:UsersUSER_NAMEAppDataLocalProgramsGitProgram FilesGitlabRunnerbuildstb7goqB##GROUP_NAMEPROJECT_NAME.tmpCI_SERVER_TLS_CA_FILE
Cleaning up project directory and file based variables
00:01
ERROR: Job failed: exit status 1
Notice the following:
C:Program FilesGitlabRunnerC;C:UsersUSER_NAMEAppDataLocalProgramsGitProgram FilesGitlabRunnerbuildstb7goqB##GROUP_NAMEPROJECT_NAME.tmpCI_SERVER_TLS_CA_FILE
Contains the path to my git program. (The section from C;
toGit
) And what is C;
? I’m assuming its windows struggling with colons inside the path.
My question
Am I missing a crucial step in my configuration? This feels like I’m shooting myself in the foot by using a buggy program, I have a feeling that those gitlab issues never got sorted.
Did I miss something from those thread?