From 1831b9fdcbb07ee1b6740225621828ca252b8556 Mon Sep 17 00:00:00 2001 From: Nick Boultbee Date: Sat, 2 Mar 2019 07:42:13 +0000 Subject: [PATCH 1/5] Fix comment for docker_machine_options (#36) * Fix example in comment for `docker_machine_options` - prepending the `--` is not necessary (in fact, breaks..) * Fix typo too --- variables.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/variables.tf b/variables.tf index adc4f73dc..23d306623 100644 --- a/variables.tf +++ b/variables.tf @@ -234,7 +234,7 @@ variable "allow_iam_service_linked_role_creation" { } variable "docker_machine_options" { - description = "Additional to set options for docker machien. Each element of the list should be key and value. E.g. '[\"--amazonec2-zone=a\"]'" + description = "Additional to set options for docker machine. Each element of the list should be key and value. E.g. '[\"amazonec2-zone=a\"]'" type = "list" default = [] } From cfb2559929c08ae8562263e25b5536d8d0624558 Mon Sep 17 00:00:00 2001 From: Nick B Date: Wed, 6 Mar 2019 22:10:09 +0000 Subject: [PATCH 2/5] Add AWS Zone support (#35) * Add new variable for AWS Availability Zone, with default `a` (as implied it seems) * Specify zone explicitly in `MachineOptions` * Update documentation * Update changelog This fixes #31 --- CHANGELOG.md | 2 ++ README.md | 1 + template/runner-config.tpl | 1 + variables.tf | 6 ++++++ 4 files changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1238aea03..5f674da45 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] +- Bugfix: Correct example for docker_machine_options #36 (@declension) +- Added: AWS Zone variable #35 (@declension) ## [2.1.0] - 2019-02-28 - Bugfix: Shared cache is not working #33 diff --git a/README.md b/README.md index 193c06a6e..11ba8bc5a 100644 --- a/README.md +++ b/README.md @@ -115,6 +115,7 @@ module "gitlab-runner" { | ami_filter | AMI filter to select the AMI used to host the gitlab runner agent. By default the pattern `amzn-ami-hvm-2018.03*-x86_64-ebs` is used for the name. Currently Amazon Linux 2 `amzn2-ami-hvm-2.0.????????-x86_64-ebs` looks *not* working for this configuration. | list | `` | no | | ami_owners | A list of owners used to select the AMI for the instance. | list | `` | no | | aws_region | AWS region. | string | - | yes | +| aws_zone | AWS availability zone. | string | 'a' | no | | cache_bucket_prefix | Prefix for s3 cache bucket name. | string | `` | no | | cache_expiration_days | Number of days before cache objects expires. | string | `1` | no | | cache_shared | Enables cache sharing between runners, false by default. | string | `false` | no | diff --git a/template/runner-config.tpl b/template/runner-config.tpl index fe87a5bed..4cf959706 100644 --- a/template/runner-config.tpl +++ b/template/runner-config.tpl @@ -35,6 +35,7 @@ check_interval = 0 MachineOptions = [ "amazonec2-instance-type=${runners_instance_type}", "amazonec2-region=${aws_region}", + "amazonec2-zone=${aws_zone}", "amazonec2-vpc-id=${runners_vpc_id}", "amazonec2-subnet-id=${runners_subnet_id}", "amazonec2-private-address-only=${runners_use_private_address}", diff --git a/variables.tf b/variables.tf index 23d306623..a130a825f 100644 --- a/variables.tf +++ b/variables.tf @@ -3,6 +3,12 @@ variable "aws_region" { type = "string" } +variable "aws_zone" { + description = "AWS availability zone (typically 'a', 'b', or 'c')." + type = "string" + default = "a" +} + variable "environment" { description = "A name that identifies the environment, will used as prefix and for tagging." type = "string" From 6cde4994e4cbeb979da8f9853bc7a3372538bd7f Mon Sep 17 00:00:00 2001 From: Niek Palm Date: Fri, 8 Mar 2019 22:25:55 +0100 Subject: [PATCH 3/5] Fix missing zone parameter in template config, rename parameter in template --- examples/runner-public/main.tf | 3 ++- main.tf | 1 + template/runner-config.tpl | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/runner-public/main.tf b/examples/runner-public/main.tf index e874c32a4..4ec067058 100644 --- a/examples/runner-public/main.tf +++ b/examples/runner-public/main.tf @@ -5,7 +5,7 @@ module "vpc" { name = "vpc-${var.environment}" cidr = "10.1.0.0/16" - azs = ["eu-west-1a"] + azs = ["eu-west-1b"] public_subnets = ["10.1.101.0/24"] tags = { @@ -26,6 +26,7 @@ module "runner" { vpc_id = "${module.vpc.vpc_id}" subnet_ids_gitlab_runner = "${module.vpc.public_subnets}" subnet_id_runners = "${element(module.vpc.public_subnets, 0)}" + aws_zone = "b" runners_name = "${var.runner_name}" runners_gitlab_url = "${var.gitlab_url}" diff --git a/main.tf b/main.tf index a1535fe4b..b51aa9972 100644 --- a/main.tf +++ b/main.tf @@ -107,6 +107,7 @@ data "template_file" "runners" { runners_vpc_id = "${var.vpc_id}" runners_subnet_id = "${var.subnet_id_runners}" + runners_aws_zone = "${var.aws_zone}" runners_instance_type = "${var.docker_machine_instance_type}" runners_spot_price_bid = "${var.docker_machine_spot_price_bid}" runners_security_group_name = "${aws_security_group.docker_machine.name}" diff --git a/template/runner-config.tpl b/template/runner-config.tpl index 4cf959706..4537aff7e 100644 --- a/template/runner-config.tpl +++ b/template/runner-config.tpl @@ -35,7 +35,7 @@ check_interval = 0 MachineOptions = [ "amazonec2-instance-type=${runners_instance_type}", "amazonec2-region=${aws_region}", - "amazonec2-zone=${aws_zone}", + "amazonec2-zone=${runners_aws_zone}", "amazonec2-vpc-id=${runners_vpc_id}", "amazonec2-subnet-id=${runners_subnet_id}", "amazonec2-private-address-only=${runners_use_private_address}", From 296ca24517a64d9a85cd3640609f7cc9ba18dad0 Mon Sep 17 00:00:00 2001 From: Niek Palm Date: Fri, 8 Mar 2019 22:34:56 +0100 Subject: [PATCH 4/5] update readme --- CHANGELOG.md | 1 + README.md | 12 ++++++------ variables.tf | 4 ++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f674da45..fc000ff26 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] +- Changed: Upgrade default runner agent to 11.8.0 and docker machine to 0.16.1 - Bugfix: Correct example for docker_machine_options #36 (@declension) - Added: AWS Zone variable #35 (@declension) diff --git a/README.md b/README.md index 11ba8bc5a..b5a9d6998 100644 --- a/README.md +++ b/README.md @@ -115,30 +115,30 @@ module "gitlab-runner" { | ami_filter | AMI filter to select the AMI used to host the gitlab runner agent. By default the pattern `amzn-ami-hvm-2018.03*-x86_64-ebs` is used for the name. Currently Amazon Linux 2 `amzn2-ami-hvm-2.0.????????-x86_64-ebs` looks *not* working for this configuration. | list | `` | no | | ami_owners | A list of owners used to select the AMI for the instance. | list | `` | no | | aws_region | AWS region. | string | - | yes | -| aws_zone | AWS availability zone. | string | 'a' | no | +| aws_zone | AWS availability zone (typically 'a', 'b', or 'c'). | string | `a` | no | | cache_bucket_prefix | Prefix for s3 cache bucket name. | string | `` | no | | cache_expiration_days | Number of days before cache objects expires. | string | `1` | no | | cache_shared | Enables cache sharing between runners, false by default. | string | `false` | no | | create_runners_iam_instance_profile | | string | `true` | no | | docker_machine_instance_type | Instance type used for the instances hosting docker-machine. | string | `m4.large` | no | -| docker_machine_options | Additional to set options for docker machien. Each element of the list should be key and value. E.g. '["--amazonec2-zone=a"]' | list | `` | no | +| docker_machine_options | Additional to set options for docker machine. Each element of the list should be key and value. E.g. '["amazonec2-zone=a"]' | list | `` | no | | docker_machine_spot_price_bid | Spot price bid. | string | `0.04` | no | | docker_machine_user | User name for the user to create spot instances to host docker-machine. | string | `docker-machine` | no | -| docker_machine_version | Version of docker-machine. | string | `0.16.0` | no | +| docker_machine_version | Version of docker-machine. | string | `0.16.1` | no | | enable_cloudwatch_logging | Enable or disable the CloudWatch logging. | string | `1` | no | | environment | A name that identifies the environment, will used as prefix and for tagging. | string | - | yes | -| gitlab_runner_version | Version for the gitlab runner. | string | `11.6.0` | no | +| gitlab_runner_version | Version for the gitlab runner. | string | `11.8.0` | no | | instance_role_json | Instance role json for the runner agent ec2 instance to override the default. | string | `` | no | | instance_role_runner_json | Instance role json for the docker machine runners to override the default. | string | `` | no | | instance_type | Instance type used for the gitlab-runner. | string | `t2.micro` | no | | runners_concurrent | Concurrent value for the runners, will be used in the runner config.toml | string | `10` | no | +| runners_executor | The executor to use. Currently supports docker+machine or docker | string | `docker+machine` | no | | runners_gitlab_url | URL of the gitlab instance to connect to. | string | - | yes | | runners_iam_instance_profile_name | IAM instance profile name of the runners, will be used in the runner config.toml | string | `` | no | | runners_idle_count | Idle count of the runners, will be used in the runner config.toml | string | `0` | no | | runners_idle_time | Idle time of the runners, will be used in the runner config.toml | string | `600` | no | | runners_image | Image to run builds, will be used in the runner config.toml | string | `docker:18.03.1-ce` | no | | runners_limit | Limit for the runners, will be used in the runner config.toml | string | `0` | no | -| runners_machine_iam_instance_profile_name | IAM instance profile name to assign to the spot instance which runs the build. | string | `` | no | | runners_monitoring | Enable detailed cloudwatch monitoring for spot instances. | string | `false` | no | | runners_name | Name of the runner, will be used in the runner config.toml | string | - | yes | | runners_off_peak_idle_count | Off peak idle count of the runners, will be used in the runner config.toml. | string | `0` | no | @@ -155,8 +155,8 @@ module "gitlab-runner" { | runners_token | Token for the runner, will be used in the runner config.toml | string | - | yes | | runners_use_private_address | Restrict runners to use only private address | string | `true` | no | | ssh_public_key | Public SSH key used for the gitlab-runner ec2 instance. | string | - | yes | -| subnet_ids_gitlab_runner | Subnets used for hosting the gitlab-runner. | list | - | yes | | subnet_id_runners | Subnet used to hosts the docker-machine runners. | string | - | yes | +| subnet_ids_gitlab_runner | Subnet used for hosting the gitlab-runner. | list | - | yes | | tags | Map of tags that will be added to created resources. By default resources will be taggen with name and environemnt. | map | `` | no | | userdata_post_install | User-data script snippet to insert after gitlab-runner install | string | `` | no | | userdata_pre_install | User-data script snippet to insert before gitlab-runner install | string | `` | no | diff --git a/variables.tf b/variables.tf index a130a825f..8ee498986 100644 --- a/variables.tf +++ b/variables.tf @@ -52,7 +52,7 @@ variable "docker_machine_spot_price_bid" { variable "docker_machine_version" { description = "Version of docker-machine." - default = "0.16.0" + default = "0.16.1" } variable "runners_name" { @@ -220,7 +220,7 @@ variable "cache_shared" { variable "gitlab_runner_version" { description = "Version for the gitlab runner." type = "string" - default = "11.6.0" + default = "11.8.0" } variable "enable_cloudwatch_logging" { From 9696d27ede374c39ae9df4623639a1b4293174b8 Mon Sep 17 00:00:00 2001 From: Niek Palm Date: Fri, 8 Mar 2019 23:03:46 +0100 Subject: [PATCH 5/5] Release 2.2.0 --- CHANGELOG.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fc000ff26..953be0b0a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] + +## [2.2.0] - 2019-03-08 - Changed: Upgrade default runner agent to 11.8.0 and docker machine to 0.16.1 - Bugfix: Correct example for docker_machine_options #36 (@declension) - Added: AWS Zone variable #35 (@declension) @@ -92,7 +94,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Update default AMI's to The latest Amazon Linux AMI 2017.09.1 - released on 2018-01-17. - Minor updates in the example -[Unreleased]: https://github.com/npalm/terraform-aws-gitlab-runner/compare/2.1.0...HEAD +[Unreleased]: https://github.com/npalm/terraform-aws-gitlab-runner/compare/2.2.0...HEAD +[2.2.0]: https://github.com/npalm/terraform-aws-gitlab-runner/compare/2.1.0...2.2.0 [2.1.0]: https://github.com/npalm/terraform-aws-gitlab-runner/compare/2.0.0...2.1.0 [2.0.0]: https://github.com/npalm/terraform-aws-gitlab-runner/compare/1.8.0...2.0.0 [1.8.0]: https://github.com/npalm/terraform-aws-gitlab-runner/compare/1.7.0...1.8.0