Updating the Gitlab Runner overwrites any custom configuration
Summary
When updating the Gitlab Runner (at least from 10.7.0 to 11.3.1), the service configuration in /etc/systemd/sytem/gitlab-runner.service
is reset. Namely, if one sets a custom work directory and user, these values are lost are set to the defaults (/home/gitlab-runner
and gitlab-runner
).
Steps to reproduce
Update the Gitlab Runner and observe changes in /etc/systemd/sytem/gitlab-runner.service
or a similar place depending on the distribution that is in use.
Example Project
N/a
What is the current bug behavior?
Any custom configuration in /etc/systemd/system/gitlab-runner.service
(or similar place) is overwritten by the default values.
What is the expected correct behavior?
If the configuration file in /etc/systemd/system/gitlab-runner.service
(or similar place) is not the same as the one shipped with the update, either:
- prompt for an action to take,
- do nothing and warn that attention is required,
- append the old configuration file's name with
.old
so as to keep it on disk and only then replace it with the new file.
Relevant logs and/or screenshots
root@asd:~# cat /etc/systemd/system/gitlab-runner.service
[Unit]
Description=GitLab Runner
After=syslog.target network.target
ConditionFileIsExecutable=/usr/bin/gitlab-runner
[Service]
StartLimitInterval=5
StartLimitBurst=10
ExecStart=/usr/bin/gitlab-runner "run" "--working-directory" "/opt/asd" "--config" "/etc/gitlab-runner/config.toml" "--service" "gitlab-runner" "--syslog" "--user" "asd"
Restart=always
RestartSec=120
[Install]
WantedBy=multi-user.target
root@asd:~# apt update
[...]
88 packages can be upgraded. Run 'apt list --upgradable' to see them.
root@asd:~# apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages were automatically installed and are no longer required:
gyp javascript-common libicu55 libjs-inherits libjs-jquery libjs-node-uuid libjs-underscore libuv1
libuv1-dev python-pkg-resources
Use 'apt autoremove' to remove them.
The following packages will be upgraded:
[...]
cpp-5 curl distro-info-data file g++-5 gcc-5 gcc-5-base git git-man gitlab-runner gnupg gpgv ifupdown
[...]
88 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 108 MB of archives.
After this operation, 8,130 kB of additional disk space will be used.
Do you want to continue? [Y/n]
[...]
Get:9 https://packages.gitlab.com/runner/gitlab-runner/ubuntu xenial/main amd64 gitlab-runner amd64 11.3.1 [28.3 MB]
[...]
Fetched 108 MB in 5s (20.7 MB/s)
Extracting templates from packages: 100%
Preconfiguring packages ...
(Reading database ... 33638 files and directories currently installed.)
[...]
Preparing to unpack .../gitlab-runner_11.3.1_amd64.deb ...
Unpacking gitlab-runner (11.3.1) over (10.7.0) ...
[...]
Setting up gitlab-runner (11.3.1) ...
GitLab Runner: detected user gitlab-runner
gitlab-ci-multi-runner: Service is not installed.
[...]
root@asd:~# cat /etc/systemd/system/gitlab-runner.service
[Unit]
Description=GitLab Runner
After=syslog.target network.target
ConditionFileIsExecutable=/usr/lib/gitlab-runner/gitlab-runner
[Service]
StartLimitInterval=5
StartLimitBurst=10
ExecStart=/usr/lib/gitlab-runner/gitlab-runner "run" "--working-directory" "/home/gitlab-runner" "--config" "/etc/gitlab-runner/config.toml" "--service" "gitlab-runner" "--syslog" "--user" "gitlab-runner"
Restart=always
RestartSec=120
[Install]
WantedBy=multi-user.target
root@asd:~#
Note it says gitlab-runner: Service is not installed.
when setting up the update, despite the runner already being installed (though in a previous version).
Output of checks
N/a
Results of GitLab environment info
N/a
Results of GitLab application Check
N/a
Possible fixes
(Couldn't find the responsible file(s))