Skip to content

Support executable directory for config listing

Romuald Atchadé requested to merge config-default-config-file into main

What does this MR do?

This MR allows GitLab Runner users on Windows to refer to config.toml located into the executable directory.

Why was this MR needed?

According to our the documentation, on non-*nix like system, the config.toml is located in ./ by default (see extract below)

You can find the config.toml file in:

  • /etc/gitlab-runner/ on *nix systems when GitLab Runner is executed as root. This directory is also the path for service configuration.
  • ~/.gitlab-runner/ on *nix systems when GitLab Runner is executed as non-root.
  • ./ on other systems.

On Windows like systems, user seems to be able to access to the config.toml located in the executable directory. This MR adds this feature without breaking existing behaviour.

What's the best way to test this MR?

  1. Build GitLab Runner from the MR Branch
  2. Execute the following command
❯ ./gitlab-runner --debug list --exec-path
Runtime platform                                    arch=arm64 os=darwin pid=8187 revision=HEAD version=development version
Listing configured runners                          ConfigFile=/Users/ratchade/projects/main-runner/config.toml
pwd
/Users/ratchade/projects/main-runner
  1. The listing is done with a config.toml located in the executable directory. In my example there was none, thus the empty list

What are the relevant issue numbers?

close gitlab#462976

Merge request reports