Skip to content

Commit d20ed4d

Browse files
author
Liora Milbaum
committed
feat: shell is also a supported executor
1 parent ae24c9c commit d20ed4d

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,8 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
189189
| <a name="input_runner_worker"></a> [runner\_worker](#input\_runner\_worker) | For detailed information, check https://docs.gitlab.com/runner/configuration/advanced-configuration.html#the-runners-section.<br><br>environment\_variables = List of environment variables to add to the Runner Worker (environment).<br>max\_jobs = Number of jobs which can be processed in parallel by the Runner Worker.<br>output\_limit = Sets the maximum build log size in kilobytes. Default is 4MB (output\_limit).<br>request\_concurrency = Limit number of concurrent requests for new jobs from GitLab (default 1) (request\_concurrency).<br>ssm\_access = Allows to connect to the Runner Worker via SSM.<br>type = The Runner Worker type to use. Currently supports `docker+machine` or `docker`. | <pre>object({<br> environment_variables = optional(list(string), [])<br> max_jobs = optional(number, 0)<br> output_limit = optional(number, 4096)<br> request_concurrency = optional(number, 1)<br> ssm_access = optional(bool, false)<br> type = optional(string, "docker+machine")<br> })</pre> | `{}` | no |
190190
| <a name="input_runner_worker_cache"></a> [runner\_worker\_cache](#input\_runner\_worker\_cache) | Configuration to control the creation of the cache bucket. By default the bucket will be created and used as shared<br>cache. To use the same cache across multiple Runner Worker disable the creation of the cache and provide a policy and<br>bucket name. See the public runner example for more details."<br><br>For detailed documentation check https://docs.gitlab.com/runner/configuration/advanced-configuration.html#the-runnerscaches3-section<br><br>access\_log\_bucker\_id = The ID of the bucket where the access logs are stored.<br>access\_log\_bucket\_prefix = The bucket prefix for the access logs.<br>authentication\_type = A string that declares the AuthenticationType for [runners.cache.s3]. Can either be 'iam' or 'credentials'<br>bucket = Name of the cache bucket. Requires `create = false`.<br>bucket\_prefix = Prefix for s3 cache bucket name. Requires `create = true`.<br>create = Boolean used to enable or disable the creation of the cache bucket.<br>expiration\_days = Number of days before cache objects expire. Requires `create = true`.<br>include\_account\_id = Boolean used to include the account id in the cache bucket name. Requires `create = true`.<br>policy = Policy to use for the cache bucket. Requires `create = false`.<br>random\_suffix = Boolean used to enable or disable the use of a random string suffix on the cache bucket name. Requires `create = true`.<br>shared = Boolean used to enable or disable the use of the cache bucket as shared cache.<br>versioning = Boolean used to enable versioning on the cache bucket. Requires `create = true`. | <pre>object({<br> access_log_bucket_id = optional(string, null)<br> access_log_bucket_prefix = optional(string, null)<br> authentication_type = optional(string, "iam")<br> bucket = optional(string, "")<br> bucket_prefix = optional(string, "")<br> create = optional(bool, true)<br> expiration_days = optional(number, 1)<br> include_account_id = optional(bool, true)<br> policy = optional(string, "")<br> random_suffix = optional(bool, false)<br> shared = optional(bool, false)<br> versioning = optional(bool, false)<br> })</pre> | `{}` | no |
191191
| <a name="input_runner_worker_docker_add_dind_volumes"></a> [runner\_worker\_docker\_add\_dind\_volumes](#input\_runner\_worker\_docker\_add\_dind\_volumes) | Add certificates and docker.sock to the volumes to support docker-in-docker (dind) | `bool` | `false` | no |
192-
| <a name="input_runner_worker_docker_machine_ami_filter"></a> [runner\_worker\_docker\_machine\_ami\_filter](#input\_runner\_worker\_docker\_machine\_ami\_filter) | List of maps used to create the AMI filter for the Runner Worker. | `map(list(string))` | <pre>{<br> "name": [<br> "ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-*"<br> ]<br>}</pre> | no |
193-
| <a name="input_runner_worker_docker_machine_ami_owners"></a> [runner\_worker\_docker\_machine\_ami\_owners](#input\_runner\_worker\_docker\_machine\_ami\_owners) | The list of owners used to select the AMI of the Runner Worker. | `list(string)` | <pre>[<br> "099720109477"<br>]</pre> | no |
192+
| <a name="input_runner_worker_ami_filter"></a> [runner\_worker\_ami\_filter](#input\_runner\_worker\_docker\_machine\_ami\_filter) | List of maps used to create the AMI filter for the Runner Worker. | `map(list(string))` | <pre>{<br> "name": [<br> "ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-*"<br> ]<br>}</pre> | no |
193+
| <a name="input_runner_worker_ami_owners"></a> [runner\_worker\_ami\_owners](#input\_runner\_worker\_ami\_owners) | The list of owners used to select the AMI of the Runner Worker. | `list(string)` | <pre>[<br> "099720109477"<br>]</pre> | no |
194194
| <a name="input_runner_worker_docker_machine_autoscaling_options"></a> [runner\_worker\_docker\_machine\_autoscaling\_options](#input\_runner\_worker\_docker\_machine\_autoscaling\_options) | Set autoscaling parameters based on periods, see https://docs.gitlab.com/runner/configuration/advanced-configuration.html#the-runnersmachine-section | <pre>list(object({<br> periods = list(string)<br> idle_count = optional(number)<br> idle_scale_factor = optional(number)<br> idle_count_min = optional(number)<br> idle_time = optional(number)<br> timezone = optional(string, "UTC")<br> }))</pre> | `[]` | no |
195195
| <a name="input_runner_worker_docker_machine_ec2_metadata_options"></a> [runner\_worker\_docker\_machine\_ec2\_metadata\_options](#input\_runner\_worker\_docker\_machine\_ec2\_metadata\_options) | Enable the Runner Worker metadata service. Requires you use CKI maintained docker machines. | <pre>object({<br> http_tokens = string<br> http_put_response_hop_limit = number<br> })</pre> | <pre>{<br> "http_put_response_hop_limit": 2,<br> "http_tokens": "required"<br>}</pre> | no |
196196
| <a name="input_runner_worker_docker_machine_ec2_options"></a> [runner\_worker\_docker\_machine\_ec2\_options](#input\_runner\_worker\_docker\_machine\_ec2\_options) | List of additional options for the docker+machine config. Each element of this list must be a key=value pair. E.g. '["amazonec2-zone=a"]' | `list(string)` | `[]` | no |

data.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,18 @@ data "aws_ami" "runner" {
2626
owners = var.runner_ami_owners
2727
}
2828

29-
data "aws_ami" "docker-machine" {
30-
count = var.runner_worker.type == "docker+machine" ? 1 : 0
29+
data "aws_ami" "runner_worker" {
30+
count = var.runner_worker.type == "docker" ? 0 : 1
3131

3232
most_recent = "true"
3333

3434
dynamic "filter" {
35-
for_each = var.runner_worker_docker_machine_ami_filter
35+
for_each = var.runner_worker_ami_filter
3636
content {
3737
name = filter.key
3838
values = filter.value
3939
}
4040
}
4141

42-
owners = var.runner_worker_docker_machine_ami_owners
42+
owners = var.runner_worker_ami_owners
4343
}

main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ locals {
9898
runners_aws_zone = data.aws_availability_zone.runners.name_suffix
9999
runners_instance_types = var.runner_worker_docker_machine_instance.types
100100
runners_spot_price_bid = var.runner_worker_docker_machine_instance_spot.max_price == "on-demand-price" || var.runner_worker_docker_machine_instance_spot.max_price == null ? "" : var.runner_worker_docker_machine_instance_spot.max_price
101-
runners_ami = var.runner_worker.type == "docker+machine" ? data.aws_ami.docker-machine[0].id : ""
101+
runners_ami = var.runner_worker.type == "docker+machine" ? data.aws_ami.runner_worker[0].id : ""
102102
runners_security_group_name = var.runner_worker.type == "docker+machine" ? aws_security_group.docker_machine[0].name : ""
103103
runners_max_growth_rate = var.runner_worker_docker_machine_instance.max_growth_rate
104104
runners_monitoring = var.runner_worker_docker_machine_instance.monitoring
@@ -316,7 +316,7 @@ resource "aws_launch_template" "fleet_gitlab_runner" {
316316
name_prefix = "${local.name_runner_agent_instance}-worker-"
317317

318318
key_name = aws_key_pair.fleet[0].key_name
319-
image_id = data.aws_ami.docker-machine[0].id
319+
image_id = data.aws_ami.runner_worker[0].id
320320
user_data = base64gzip(var.runner_worker_docker_machine_instance.start_script)
321321
instance_type = var.runner_worker_docker_machine_instance.types[0] # it will be override by the fleet
322322
update_default_version = true

migrations/migrate-to-7-0-0.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ sed 's/runner_root_block_device/runner_root_block_device/g' | \
124124
sed 's/gitlab_runner_registration_config/runner_gitlab_registration_config/g' | \
125125
sed 's/[^_]ami_filter/runner_ami_filter/g' | \
126126
sed 's/[^_]ami_owners/runner_ami_owners/g' | \
127-
sed 's/runner_ami_filter/runner_worker_docker_machine_ami_filter/g' | \
128-
sed 's/runner_ami_owners/runner_worker_docker_machine_ami_owners/g' | \
127+
sed 's/runner_ami_filter/runner_worker_ami_filter/g' | \
128+
sed 's/runner_ami_owners/runner_worker_ami_owners/g' | \
129129
sed 's/instance_role_json/runner_assume_role_json/g' | \
130130
sed 's/docker_machine_role_json/runner_worker_docker_machine_assume_role_json/g' | \
131131
sed 's/role_tags/runner_extra_role_tags/g' | \

variables.tf

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ variable "runner_worker" {
381381
output_limit = Sets the maximum build log size in kilobytes. Default is 4MB (output_limit).
382382
request_concurrency = Limit number of concurrent requests for new jobs from GitLab (default 1) (request_concurrency).
383383
ssm_access = Allows to connect to the Runner Worker via SSM.
384-
type = The Runner Worker type to use. Currently supports `docker+machine` or `docker`.
384+
type = The Runner Worker type (executor) to use. Currently supports `docker+machine`, `docker` and `shell`.
385385
EOT
386386
type = object({
387387
environment_variables = optional(list(string), [])
@@ -394,8 +394,8 @@ variable "runner_worker" {
394394
default = {}
395395

396396
validation {
397-
condition = contains(["docker+machine", "docker"], var.runner_worker.type)
398-
error_message = "The executor currently supports `docker+machine` and `docker`."
397+
condition = contains(["docker+machine", "docker", "shell"], var.runner_worker.type)
398+
error_message = "The supported executors are `docker+machine`, `docker` and `shell`."
399399
}
400400
}
401401

@@ -632,7 +632,7 @@ variable "runner_worker_docker_machine_security_group_description" {
632632
default = "A security group containing Runner Worker instances"
633633
}
634634

635-
variable "runner_worker_docker_machine_ami_filter" {
635+
variable "runner_worker_ami_filter" {
636636
description = "List of maps used to create the AMI filter for the Runner Worker."
637637
type = map(list(string))
638638

@@ -641,7 +641,7 @@ variable "runner_worker_docker_machine_ami_filter" {
641641
}
642642
}
643643

644-
variable "runner_worker_docker_machine_ami_owners" {
644+
variable "runner_worker_ami_owners" {
645645
description = "The list of owners used to select the AMI of the Runner Worker."
646646
type = list(string)
647647

0 commit comments

Comments
 (0)