diff --git a/.cloudbees/workflows/bp-tf-ci.yaml b/.cloudbees/workflows/bp-tf-ci.yaml index 60ec43ac..63c14c01 100644 --- a/.cloudbees/workflows/bp-tf-ci.yaml +++ b/.cloudbees/workflows/bp-tf-ci.yaml @@ -28,6 +28,7 @@ env: company = "CloudBees Inc." } suffix = "ci-v4" + ci = true jobs: init: diff --git a/blueprints/01-getting-started/README.md b/blueprints/01-getting-started/README.md index 13c2794c..2e6e935c 100644 --- a/blueprints/01-getting-started/README.md +++ b/blueprints/01-getting-started/README.md @@ -32,6 +32,7 @@ This blueprint presents the minimum setup to run CloudBees CI on Amazon EKS: One |------|-------------|------|---------|:--------:| | hosted_zone | Amazon Route 53 hosted zone. CloudBees CI applications are configured to use subdomains in this hosted zone. | `string` | n/a | yes | | trial_license | CloudBees CI trial license details for evaluation. | `map(string)` | n/a | yes | +| ci | Running in a CI Service vs locally. False when running locally, true when running in a CI service | `bool` | `false` | no | | suffix | Unique suffix to assign to all resources. | `string` | `""` | no | | tags | Tags to apply to resources. | `map(string)` | `{}` | no | diff --git a/blueprints/01-getting-started/main.tf b/blueprints/01-getting-started/main.tf index a443aed6..9b3995e2 100644 --- a/blueprints/01-getting-started/main.tf +++ b/blueprints/01-getting-started/main.tf @@ -226,13 +226,11 @@ resource "kubernetes_storage_class_v1" "gp3" { } -resource "null_resource" "create_kubeconfig" { - +# Kubeconfig +resource "terraform_data" "create_kubeconfig" { depends_on = [module.eks] - triggers = { - always_run = timestamp() - } + triggers_replace = var.ci ? [timestamp()] : [] provisioner "local-exec" { command = "aws eks update-kubeconfig --name ${module.eks.cluster_name} --region ${local.region} --kubeconfig ${local.kubeconfig_file_path}" diff --git a/blueprints/01-getting-started/providers.tf b/blueprints/01-getting-started/providers.tf index 1c5c4ecf..9af5106e 100644 --- a/blueprints/01-getting-started/providers.tf +++ b/blueprints/01-getting-started/providers.tf @@ -14,10 +14,6 @@ terraform { source = "hashicorp/helm" version = ">= 2.5.1" } - null = { - source = "hashicorp/null" - version = ">= 3.1.0" - } } } diff --git a/blueprints/01-getting-started/variables.tf b/blueprints/01-getting-started/variables.tf index 7acec7d4..c8f674c2 100644 --- a/blueprints/01-getting-started/variables.tf +++ b/blueprints/01-getting-started/variables.tf @@ -24,3 +24,9 @@ variable "suffix" { error_message = "The suffix cannot contain more than 10 characters." } } + +variable "ci" { + description = "Running in a CI Service vs locally. False when running locally, true when running in a CI service" + default = false + type = bool +} \ No newline at end of file diff --git a/blueprints/02-at-scale/README.md b/blueprints/02-at-scale/README.md index 6c062e46..d3529236 100644 --- a/blueprints/02-at-scale/README.md +++ b/blueprints/02-at-scale/README.md @@ -64,6 +64,7 @@ This blueprint divides scalable Node Groups for different types of workloads: |------|-------------|------|---------|:--------:| | hosted_zone | Amazon Route 53 hosted zone. CloudBees CI applications are configured to use subdomains in this hosted zone. | `string` | n/a | yes | | trial_license | CloudBees CI trial license details for evaluation. | `map(string)` | n/a | yes | +| ci | Running in a CI Service vs locally. False when running locally, true when running in a CI service, | `bool` | `false` | no | | gh_token | GitHub token for the CloudBees operations center credential GH-User-token, that is created via CloudBees CasC. | `string` | `"ExampleToken1234"` | no | | gh_user | GitHub user for the CloudBees operations center credential GH-User-token, that is created via CloudBees CasC. | `string` | `"exampleUser"` | no | | suffix | Unique suffix to assign to all resources. When adding the suffix, changes are required in CloudBees CI for the validation phase. | `string` | `""` | no | diff --git a/blueprints/02-at-scale/main.tf b/blueprints/02-at-scale/main.tf index 6157261f..b609e21f 100644 --- a/blueprints/02-at-scale/main.tf +++ b/blueprints/02-at-scale/main.tf @@ -643,14 +643,11 @@ resource "kubernetes_storage_class_v1" "efs" { } # Kubeconfig - -resource "null_resource" "create_kubeconfig" { - +resource "terraform_data" "create_kubeconfig" { depends_on = [module.eks] - triggers = { - always_run = timestamp() - } + triggers_replace = var.ci ? [timestamp()] : [] + provisioner "local-exec" { command = "aws eks update-kubeconfig --name ${module.eks.cluster_name} --region ${local.region} --kubeconfig ${local.kubeconfig_file_path}" } diff --git a/blueprints/02-at-scale/providers.tf b/blueprints/02-at-scale/providers.tf index 49400d71..5444706a 100644 --- a/blueprints/02-at-scale/providers.tf +++ b/blueprints/02-at-scale/providers.tf @@ -24,11 +24,6 @@ terraform { version = ">= 0.7.1" } - null = { - source = "hashicorp/null" - version = ">= 3.1.0" - } - random = { source = "hashicorp/random" version = ">= 3.6.1" diff --git a/blueprints/02-at-scale/variables.tf b/blueprints/02-at-scale/variables.tf index 8d4bc3ab..e0bff121 100644 --- a/blueprints/02-at-scale/variables.tf +++ b/blueprints/02-at-scale/variables.tf @@ -36,3 +36,9 @@ variable "gh_token" { default = "ExampleToken1234" type = string } + +variable "ci" { + description = "Running in a CI Service vs locally. False when running locally, true when running in a CI service," + default = false + type = bool +} \ No newline at end of file diff --git a/values.yml b/values.yml index 82e6a2b1..b718af6e 100644 --- a/values.yml +++ b/values.yml @@ -7,7 +7,6 @@ Subdomain: true OperationsCenter: JavaOpts: >- - -Dcom.cloudbees.masterprovisioning.kubernetes.KubernetesMasterProvisioning.deleteClaim=true -Duser.timezone=Etc/UTC -XX:InitialRAMPercentage=50.0 -XX:MaxRAMPercentage=50.0