Cilicon
Cilicon copied to clipboard
Using advanced configurations for GitLab Runners (config.toml)
Thanks to #38 it's now possible to define more advanced configuration options for GitLab Runners 🎉.
However I had some difficulties to get it to work:
- Right now #38 isn't released while the Readme is already updated which is a little bit misleading (took me quite some time to figure out, why my configuration was ignored by the runner).
- In the Readme it's not written that you have to pass your options as a multiline-argument omitting
[[runners]]
because this part is already present (see below). Instead it sounds a bit like you have to pass the path to aconfig.toml
file. Relevant code inGitLabRunnerProvisioner.swift
:
let copyConfigTomlCommand = """
mkdir -p ~/.gitlab-runner
rm -rf ~/.gitlab-runner/config.toml
cat <<'EOF' >> ~/.gitlab-runner/config.toml
[[runners]]
url = "\(config.gitlabURL)"
token = "\(config.runnerToken)"
executor = "\(config.executor)"
limit = \(config.maxNumberOfBuilds)
\(config.configToml ?? "")
EOF
exit 1
"""
Especially 2. should be addressed imho 🙂 ...
I just realized, that the runner isn't restarted anymore. Instead it logs WARNING: Failed to process runner
.
This might be related to a difference between the --max-builds
option of gitlab-runner run-single
and the limit
attribute in config.toml
(introduced in #38 as a replacement for --max-builds
).
--max-builds
(https://docs.gitlab.com/runner/commands/#gitlab-runner-run-single):
You can use the --max-builds option to control how many builds the runner executes before exiting. The default of 0 means that the runner has no build limit and jobs run forever.
limit
(https://docs.gitlab.com/runner/configuration/advanced-configuration.html#the-runners-section):
Limit how many jobs can be handled concurrently by this registered runner. 0 (default) means do not limit.
@ast3150 Any response would be much appreciated.
Let‘s see. About the release, probably @Marcocanc can help, but let‘s resolve the other issues first.
I see how the Readme can be worded more clearly. I struggled a bit to come up with an explanation which is concise. If you have a suggestion please let me know.
About the limit
parameter, seeing that it absolutely does not do the same thing as —max-builds
– I consider this a mistake on my side and would suggest forcing the limit to 1
to make sure builds don‘t run in parallel.
The maxNumberOfBuilds
config value should probably be removed as it doesn‘t seem to apply to gitlab-runner run
like it did to gitlab-runner run-single
As for the runner error, is it possible that there is some other issue with your runner configuration setup or registration? Can you provide more info about when this happens and what you‘ve tried to resolve it?
Thanks for your reply. I examined the error / warning a bit further and it only appears if the job execution fails (caused by .gitlab-ci.yml
). But subsequent jobs are executed fine. I have run the runner with gitlab-runner --debug run
and the more detailed logs didn't provide much additional information. So I guess there is no action required at the moment.
Do you have a workaround to get the ephemeral behaviour for GitLab runners while still providing config.toml
options?