diff --git a/knowledge base/gitlab/runner.md b/knowledge base/gitlab/runner.md index 4562112..c9310ba 100644 --- a/knowledge base/gitlab/runner.md +++ b/knowledge base/gitlab/runner.md @@ -171,27 +171,43 @@ The manager will connect to the instances via SSH and execute Docker commands. T able to execute those commands commands (most likely by being part of the `docker` group on the instances). Container images are pulled by the manager and sent to the instances it creates.
-The instances do not require container registry access themselves this way. +The instances do **not** require container registry access themselves this way. -Add the following settings in the `config.toml` file: +
+ Setup -```toml -[[runners]] - executor = "docker-autoscaler" +1. Configure the default region for the SDK to use in the runner executor user's related file.
+ Adding it as environment variable in the runner's configuration file does **not** work. - [runners.docker] - image = "busybox:latest" # or whatever +
+ AWS - [runners.autoscaler] - plugin = "aws:latest" # or 'googlecloud' or 'azure' or whatever + `$HOME/.aws/config` - [runners.autoscaler.plugin_config] - name = "…" # see plugin docs + ```ini + [default] + region = eu-west-1 + ``` - [[runners.autoscaler.policy]] - idle_count = 5 - idle_time = "20m0s" -``` +
+ +1. Add at least the following in the runner's `config.toml` file: + + ```toml + [[runners]] + executor = "docker-autoscaler" + + [runners.docker] + image = "busybox:latest" # or whatever + + [runners.autoscaler] + plugin = "aws:latest" # or 'googlecloud' or 'azure' or whatever + + [runners.autoscaler.plugin_config] + name = "…" # see plugin docs + ``` + +
Example: AWS, 1 instance per job, 5 idle instances for 20min. @@ -322,18 +338,6 @@ Procedure:
- This could probably just be configured in the executor's setting, but I still need to confirm it. - -
- - ```toml - [[runners]] - executor = "docker-autoscaler" - environment = [ "AWS_REGION=eu-west-1" ] - ``` - -
- 1. Install the gitlab runner on the **manager** instance. 1. Configure the runner to use the `docker-autoscaler` executor. diff --git a/snippets/gitlab/gitlab-runner.sh b/snippets/gitlab/gitlab-runner.sh index 1212852..70f8331 100644 --- a/snippets/gitlab/gitlab-runner.sh +++ b/snippets/gitlab/gitlab-runner.sh @@ -32,6 +32,12 @@ gitlab-runner verify -c '/etc/gitlab-runner/config.toml' # Also delete runners that have been removed from the main instance gitlab-runner verify … --delete +# Unregister runners +gitlab-runner unregister --name 'some-runner' +gitlab-runner unregister --token 'abcdefghij0123456789' +gitlab-runner unregister --all-runners +curl -fsX 'DELETE' 'https://gitlab.com/api/v4/runners/2207' -H 'PRIVATE-TOKEN: glpat-m-…' + # Unregister offline runners curl -fs 'https://gitlab.com/api/v4/runners/all?status=offline&per_page=100' -H 'PRIVATE-TOKEN: glpat-m-…' \ | jq '.[].id' \