Skip to content

Commit

Permalink
Merge branch 'release/4.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
npalm committed Aug 19, 2019
2 parents 85e3ffa + d3fa369 commit ff30b9d
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 2 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).


## 4.3.0 - 2019-08-19

- Added
- Add MaxBuilds variable to gitlab runner config #122 @gertjanmaas

## 4.2.0 - 2019-08-18

- Added
Expand Down Expand Up @@ -210,7 +215,8 @@ Module is available as Terraform 0.11 module, pin module to version 3.x. Please
- 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/4.2.0...HEAD
[Unreleased]: https://github.com/npalm/terraform-aws-gitlab-runner/compare/4.3.0...HEAD
[4.3.0]: https://github.com/npalm/terraform-aws-gitlab-runner/compare/4.2.0...4.3.0
[4.2.0]: https://github.com/npalm/terraform-aws-gitlab-runner/compare/4.1.0...4.2.0
[4.1.0]: https://github.com/npalm/terraform-aws-gitlab-runner/compare/4.0.0...4.1.0
[4.0.0]: https://github.com/npalm/terraform-aws-gitlab-runner/compare/3.10.0...4.0.0
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ terraform destroy
| aws\_region | AWS region. | string | n/a | yes |
| aws\_zone | AWS availability zone (typically 'a', 'b', or 'c'). | string | `"a"` | no |
| cache\_bucket | Configuration to control the creation of the cache bucket. By default the bucket will be created and used as shared cache. To use the same cache cross multiple runners disable the cration of the cache and provice a policy and bucket name. See the public runner example for more details. | map | `<map>` | no |
| cache\_bucket\_name\_include\_account\_id | Boolean to add current account ID to cache bucket name. | bool | `"true"` | no |
| cache\_bucket\_prefix | Prefix for s3 cache bucket name. | string | `""` | no |
| cache\_bucket\_versioning | Boolean used to enable versioning on the cache bucket, false by default. | bool | `"false"` | no |
| cache\_expiration\_days | Number of days before cache objects expires. | number | `"1"` | no |
Expand Down Expand Up @@ -257,6 +258,7 @@ terraform destroy
| runners\_idle\_time | Idle time of the runners, will be used in the runner config.toml. | number | `"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. | number | `"0"` | no |
| runners\_max\_builds | Max builds for each runner after which it will be removed, will be used in the runner config.toml. By default set to 0, no maxBuilds will be set in the configuration. | number | `"0"` | no |
| runners\_monitoring | Enable detailed cloudwatch monitoring for spot instances. | bool | `"false"` | no |
| runners\_name | Name of the runner, will be used in the runner config.toml. | string | n/a | yes |
| runners\_off\_peak\_idle\_count | Off peak idle count of the runners, will be used in the runner config.toml. | number | `"0"` | no |
Expand Down
3 changes: 3 additions & 0 deletions _docs/TF_MODULE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
| aws\_region | AWS region. | string | n/a | yes |
| aws\_zone | AWS availability zone (typically 'a', 'b', or 'c'). | string | `"a"` | no |
| cache\_bucket | Configuration to control the creation of the cache bucket. By default the bucket will be created and used as shared cache. To use the same cache cross multiple runners disable the cration of the cache and provice a policy and bucket name. See the public runner example for more details. | map | `<map>` | no |
| cache\_bucket\_name\_include\_account\_id | Boolean to add current account ID to cache bucket name. | bool | `"true"` | no |
| cache\_bucket\_prefix | Prefix for s3 cache bucket name. | string | `""` | no |
| cache\_bucket\_versioning | Boolean used to enable versioning on the cache bucket, false by default. | bool | `"false"` | no |
| cache\_expiration\_days | Number of days before cache objects expires. | number | `"1"` | no |
Expand Down Expand Up @@ -44,6 +45,7 @@
| runners\_idle\_time | Idle time of the runners, will be used in the runner config.toml. | number | `"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. | number | `"0"` | no |
| runners\_max\_builds | Max builds for each runner after which it will be removed, will be used in the runner config.toml. By default set to 0, no maxBuilds will be set in the configuration. | number | `"0"` | no |
| runners\_monitoring | Enable detailed cloudwatch monitoring for spot instances. | bool | `"false"` | no |
| runners\_name | Name of the runner, will be used in the runner config.toml. | string | n/a | yes |
| runners\_off\_peak\_idle\_count | Off peak idle count of the runners, will be used in the runner config.toml. | number | `"0"` | no |
Expand Down Expand Up @@ -82,3 +84,4 @@
| runner\_cache\_bucket\_name | Name of the S3 for the build cache. |
| runner\_role\_arn | ARN of the role used for the docker machine runners. |
| runner\_role\_name | Name of the role used for the docker machine runners. |

3 changes: 2 additions & 1 deletion cache/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This sub module creates an S3 bucket for build caches. The cache will have by de

## Usages

```
```
module "cache" {
source = "https://github.com/npalm/terraform-aws-gitlab-runner/tree/move-cache-to-moudle/cache"
Expand All @@ -29,6 +29,7 @@ module "runner" {

| Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:|
| cache\_bucket\_name\_include\_account\_id | Boolean to add current account ID to cache bucket name. | bool | `"true"` | no |
| cache\_bucket\_prefix | Prefix for s3 cache bucket name. | string | `""` | no |
| cache\_bucket\_versioning | Boolean used to enable versioning on the cache bucket, false by default. | string | `"false"` | no |
| cache\_expiration\_days | Number of days before cache objects expires. | number | `"1"` | no |
Expand Down
2 changes: 2 additions & 0 deletions cache/_docs/TF_MODULE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

| Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:|
| cache\_bucket\_name\_include\_account\_id | Boolean to add current account ID to cache bucket name. | bool | `"true"` | no |
| cache\_bucket\_prefix | Prefix for s3 cache bucket name. | string | `""` | no |
| cache\_bucket\_versioning | Boolean used to enable versioning on the cache bucket, false by default. | string | `"false"` | no |
| cache\_expiration\_days | Number of days before cache objects expires. | number | `"1"` | no |
Expand All @@ -16,3 +17,4 @@
| arn | The ARN of the created bucket. |
| bucket | Name of the created bucket. |
| policy\_arn | Policy for users of the cache (bucket). |

3 changes: 3 additions & 0 deletions locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ locals {
// Ensure off peak is optional
runners_off_peak_periods_string = var.runners_off_peak_periods == "" ? "" : format("OffPeakPeriods = %s", var.runners_off_peak_periods)

// Ensure max builds is optional
runners_max_builds_string = var.runners_max_builds == 0 ? "" : format("MaxBuilds = %d", var.runners_max_builds)

// Define key for runner token for SSM
secure_parameter_store_runner_token_key = "${var.environment}-${var.secure_parameter_store_runner_token_key}"

Expand Down
1 change: 1 addition & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ data "template_file" "runners" {
runners_pull_policy = var.runners_pull_policy
runners_idle_count = var.runners_idle_count
runners_idle_time = var.runners_idle_time
runners_max_builds = local.runners_max_builds_string
runners_off_peak_timezone = var.runners_off_peak_timezone
runners_off_peak_idle_count = var.runners_off_peak_idle_count
runners_off_peak_idle_time = var.runners_off_peak_idle_time
Expand Down
1 change: 1 addition & 0 deletions template/runner-config.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ check_interval = 0
[runners.machine]
IdleCount = ${runners_idle_count}
IdleTime = ${runners_idle_time}
${runners_max_builds}
MachineDriver = "amazonec2"
MachineName = "runner-%s"
MachineOptions = [
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@ variable "runners_idle_count" {
default = 0
}

variable "runners_max_builds" {
description = "Max builds for each runner after which it will be removed, will be used in the runner config.toml. By default set to 0, no maxBuilds will be set in the configuration."
type = number
default = 0
}

variable "runners_image" {
description = "Image to run builds, will be used in the runner config.toml"
type = string
Expand Down

0 comments on commit ff30b9d

Please sign in to comment.