Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using advanced configurations for GitLab Runners (config.toml) #42

Open
finebel opened this issue Oct 19, 2023 · 3 comments
Open

Using advanced configurations for GitLab Runners (config.toml) #42

finebel opened this issue Oct 19, 2023 · 3 comments

Comments

@finebel
Copy link

finebel commented Oct 19, 2023

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:

  1. Right now Pass advanced configuration to GitLab Runner #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).
  2. 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 a config.toml file.
    Relevant code in GitLabRunnerProvisioner.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 🙂 ...

@finebel
Copy link
Author

finebel commented Oct 19, 2023

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.

@ast3150
Copy link
Contributor

ast3150 commented Oct 19, 2023

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?

@finebel
Copy link
Author

finebel commented Oct 20, 2023

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants