Skip to content

Dont swallow configfile permission errors on registering a runner

What does this MR do?

I noticed running gitlab-runner register command failed silently to update/create the config file when gitlab-runner was run as an user without permission to write to the config file location.

This merge request adds the the missing error handling conditional to the commands/register.go file and also lets the SaveConfig method in common/config.go fail as early as creating the config file location fails.

Why was this MR needed?

Without the changes it is possible to execute register successfully without making the changes to the config file to reflect the newly registered runner.

For example when the runner is run inside a container with the gitlab-runner user and the config file location is mounted on the local file system. Docker creates the host directories with the user which ran docker run (But not on mac os, this only happened to me on linux)

Does this MR meet the acceptance criteria?

  • Documentation created/updated
  • Tests
    • Added for this feature/bug
    • All builds are passing
  • Branch has no merge conflicts with master (if you do - rebase it please)
Edited by Gerald

Merge request reports