Skip to content

Commit 697f962

Browse files
committed
fix variables
1 parent 70cb33e commit 697f962

File tree

2 files changed

+97
-0
lines changed

2 files changed

+97
-0
lines changed

main.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,11 @@ module "runner" {
111111
docker_machine_fleet_launch_template_name = var.runner_worker_docker_machine_fleet.enable == true ? aws_launch_template.fleet_gitlab_runner[0].name : ""
112112
docker_machine_tags = local.runner_tags_merged
113113
docker_machine_instance = var.runner_worker_docker_machine_instance
114+
115+
runner_worker = var.runner_worker
116+
runner_worker_docker_autoscaler = var.runner_worker_docker_autoscaler
117+
runner_worker_gitlab_pipeline = var.runner_worker_gitlab_pipeline
118+
runner_gitlab = var.runner_gitlab
114119
}
115120

116121
# ignores: Autoscaling Groups Supply Tags --> we use a "dynamic" block to create the tags

modules/runner-config/variables.tf

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,3 +107,95 @@ variable "docker_machine_instance" {
107107
error_message = "Supported volume types: gp2, gp3, io1 and io2"
108108
}
109109
}
110+
111+
variable "runner_worker" {
112+
description = <<-EOT
113+
For detailed information, check https://docs.gitlab.com/runner/configuration/advanced-configuration.html#the-runners-section.
114+
115+
environment_variables = List of environment variables to add to the Runner Worker (environment).
116+
max_jobs = Number of jobs which can be processed in parallel by the Runner Worker.
117+
output_limit = Sets the maximum build log size in kilobytes. Default is 4MB (output_limit).
118+
request_concurrency = Limit number of concurrent requests for new jobs from GitLab (default 1) (request_concurrency).
119+
ssm_access = Allows to connect to the Runner Worker via SSM.
120+
type = The Runner Worker type to use. Currently supports `docker+machine` or `docker` or `docker-autoscaler`.
121+
use_private_key = Use a private key to connect the Runner Manager to the Runner Workers. Ignored when fleeting is enabled (defaults to `true`).
122+
EOT
123+
type = object({
124+
environment_variables = optional(list(string), [])
125+
max_jobs = optional(number, 0)
126+
output_limit = optional(number, 4096)
127+
request_concurrency = optional(number, 1)
128+
ssm_access = optional(bool, false)
129+
type = optional(string, "docker+machine")
130+
# false positive, use_private_key is not a secret
131+
# kics-scan ignore-line
132+
use_private_key = optional(bool, false)
133+
})
134+
default = {}
135+
136+
validation {
137+
condition = contains(["docker+machine", "docker", "docker-autoscaler"], var.runner_worker.type)
138+
error_message = "The executor currently supports `docker+machine` and `docker`."
139+
}
140+
}
141+
142+
variable "runner_worker_docker_autoscaler" {
143+
description = <<-EOT
144+
fleeting_plugin_version = The version of aws fleeting plugin.
145+
connector_config_user = User to connect to worker machine.
146+
key_pair_name = The name of the key pair used by the Runner to connect to the docker-machine Runner Workers. This variable is only supported when `enables` is set to `true`.
147+
capacity_per_instance = The number of jobs that can be executed concurrently by a single instance.
148+
max_use_count = Max job number that can run on a worker.
149+
update_interval = The interval to check with the fleeting plugin for instance updates.
150+
update_interval_when_expecting = The interval to check with the fleeting plugin for instance updates when expecting a state change.
151+
instance_ready_command = Executes this command on each instance provisioned by the autoscaler to ensure that it is ready for use. A failure results in the instance being removed.
152+
EOT
153+
type = object({
154+
fleeting_plugin_version = optional(string, "1.0.0")
155+
connector_config_user = optional(string, "ec2-user")
156+
key_pair_name = optional(string, "runner-worker-key")
157+
capacity_per_instance = optional(number, 1)
158+
max_use_count = optional(number, 100)
159+
update_interval = optional(string, "1m")
160+
update_interval_when_expecting = optional(string, "2s")
161+
instance_ready_command = optional(string, "")
162+
})
163+
default = {}
164+
}
165+
166+
variable "runner_worker_gitlab_pipeline" {
167+
description = <<-EOT
168+
post_build_script = Script to execute in the pipeline just after the build, but before executing after_script.
169+
pre_build_script = Script to execute in the pipeline just before the build.
170+
pre_clone_script = Script to execute in the pipeline before cloning the Git repository. this can be used to adjust the Git client configuration first, for example.
171+
EOT
172+
type = object({
173+
post_build_script = optional(string, "\"\"")
174+
pre_build_script = optional(string, "\"\"")
175+
pre_clone_script = optional(string, "\"\"")
176+
})
177+
default = {}
178+
}
179+
180+
variable "runner_gitlab" {
181+
description = <<-EOT
182+
ca_certificate = Trusted CA certificate bundle (PEM format).
183+
certificate = Certificate of the GitLab instance to connect to (PEM format).
184+
registration_token = (deprecated, This is replaced by the `registration_token` in `runner_gitlab_registration_config`.) Registration token to use to register the Runner.
185+
runner_version = Version of the [GitLab Runner](https://gitlab.com/gitlab-org/gitlab-runner/-/releases). Make sure that it is available for your AMI. See https://packages.gitlab.com/app/runner/gitlab-runner/search?dist=amazon%2F2023&filter=rpms&page=1&q=
186+
url = URL of the GitLab instance to connect to.
187+
url_clone = URL of the GitLab instance to clone from. Use only if the agent can’t connect to the GitLab URL.
188+
access_token_secure_parameter_store_name = (deprecated) The name of the SSM parameter to read the GitLab access token from. It must have the `api` scope and be pre created.
189+
preregistered_runner_token_ssm_parameter_name = The name of the SSM parameter to read the preregistered GitLab Runner token from.
190+
EOT
191+
type = object({
192+
ca_certificate = optional(string, "")
193+
certificate = optional(string, "")
194+
registration_token = optional(string, "__REPLACED_BY_USER_DATA__") # deprecated, removed in 8.0.0
195+
runner_version = optional(string, "16.0.3")
196+
url = optional(string, "")
197+
url_clone = optional(string, "")
198+
access_token_secure_parameter_store_name = optional(string, "gitlab-runner-access-token") # deprecated, removed in 8.0.0
199+
preregistered_runner_token_ssm_parameter_name = optional(string, "")
200+
})
201+
}

0 commit comments

Comments
 (0)