Skip to content

Commit ce70539

Browse files
authored
Enable worker pool support in the CICD recipe (#1023)
* Enable worker pool support in the CICD recipe. Allows CICD to access private resources such as GKE clusters with private endpoints. #996
1 parent 712e6fc commit ce70539

File tree

28 files changed

+168
-0
lines changed

28 files changed

+168
-0
lines changed

docs/tfengine/schemas/cicd.md

+4
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@
2626
| envs.triggers.validate | Config block for the presubmit validation Cloud Build trigger. If specified, create the trigger and grant the Cloud Build Service Account necessary permissions to perform the build. | object | false | - | - |
2727
| envs.triggers.validate.run_on_push | Whether or not to be automatically triggered from a PR/push to branch. Default to true. | boolean | false | - | - |
2828
| envs.triggers.validate.run_on_schedule | Whether or not to be automatically triggered according a specified schedule. The schedule is specified using [unix-cron format](https://cloud.google.com/scheduler/docs/configuring/cron-job-schedules#defining_the_job_schedule) at Eastern Standard Time (EST). Default to none. | string | false | - | - |
29+
| envs.worker_pool | Optional Cloud Build private worker pool configuration. Required for CICD to access resources in a private network, e.g. GKE clusters with a private endpoint. | object | false | - | - |
30+
| envs.worker_pool.location | GCP region of the worker pool. Example: us-central1. | string | true | - | - |
31+
| envs.worker_pool.name | Name of the worker pool. | string | true | - | - |
32+
| envs.worker_pool.project | The project worker pool belongs. | string | true | - | - |
2933
| github | Config for GitHub Cloud Build triggers. | object | false | - | - |
3034
| github.name | GitHub repo name. | string | false | - | - |
3135
| github.owner | GitHub repo owner. | string | false | - | - |

examples/tfengine/generated/devops/cicd/configs/tf-apply.yaml

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/tfengine/generated/devops/cicd/configs/tf-plan.yaml

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/tfengine/generated/devops/cicd/configs/tf-validate.yaml

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/tfengine/generated/devops/cicd/triggers.tf

+4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/tfengine/generated/folder_foundation/cicd/configs/tf-apply.yaml

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/tfengine/generated/folder_foundation/cicd/configs/tf-plan.yaml

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/tfengine/generated/folder_foundation/cicd/configs/tf-validate.yaml

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/tfengine/generated/folder_foundation/cicd/triggers.tf

+4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/tfengine/generated/multi_envs/cicd/configs/tf-apply.yaml

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/tfengine/generated/multi_envs/cicd/configs/tf-plan.yaml

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/tfengine/generated/multi_envs/cicd/configs/tf-validate.yaml

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/tfengine/generated/multi_envs/cicd/triggers.tf

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/tfengine/generated/org_foundation/cicd/configs/tf-apply.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ timeout: 21600s
1919
substitutions:
2020
_TERRAFORM_ROOT: "."
2121
_MANAGED_DIRS: ""
22+
_WORKER_POOL: ""
2223

2324
steps:
2425
- name: "gcr.io/cloud-foundation-cicd/cft/developer-tools-light@sha256:d881ce4ff2a73fa0877dd357af798a431a601b2ccfe5a140837bcb883cd3f011"
@@ -37,3 +38,7 @@ steps:
3738
args: ["./cicd/configs/run.sh", "-d", "${_MANAGED_DIRS}", "-a", "init", "-a", "plan", "-a", "apply -auto-approve"]
3839
dir: "${_TERRAFORM_ROOT}"
3940
id: Apply
41+
42+
options:
43+
pool:
44+
name: "${_WORKER_POOL}"

examples/tfengine/generated/org_foundation/cicd/configs/tf-plan.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ timeout: 1200s
1919
substitutions:
2020
_TERRAFORM_ROOT: "."
2121
_MANAGED_DIRS: ""
22+
_WORKER_POOL: ""
2223

2324
steps:
2425
- name: "gcr.io/cloud-foundation-cicd/cft/developer-tools-light@sha256:d881ce4ff2a73fa0877dd357af798a431a601b2ccfe5a140837bcb883cd3f011"
@@ -38,3 +39,7 @@ steps:
3839
args: ["./cicd/configs/tf-deletion-check.sh", "./cicd/configs/tf-deletion-allowlist.txt"]
3940
dir: "${_TERRAFORM_ROOT}"
4041
id: Resource deletion check
42+
43+
options:
44+
pool:
45+
name: "${_WORKER_POOL}"

examples/tfengine/generated/org_foundation/cicd/configs/tf-validate.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ timeout: 600s
1919
substitutions:
2020
_TERRAFORM_ROOT: "."
2121
_MANAGED_DIRS: ""
22+
_WORKER_POOL: ""
2223

2324
steps:
2425
- name: "gcr.io/cloud-foundation-cicd/cft/developer-tools-light@sha256:d881ce4ff2a73fa0877dd357af798a431a601b2ccfe5a140837bcb883cd3f011"
@@ -37,3 +38,7 @@ steps:
3738
args: ["./cicd/configs/run.sh", "-d", "${_MANAGED_DIRS}", "-a", "init -backend=false", "-a", "validate"]
3839
dir: "${_TERRAFORM_ROOT}"
3940
id: Validate
41+
42+
options:
43+
pool:
44+
name: "${_WORKER_POOL}"

examples/tfengine/generated/org_foundation/cicd/triggers.tf

+3
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ resource "google_cloudbuild_trigger" "validate_prod" {
3636
substitutions = {
3737
_TERRAFORM_ROOT = "terraform"
3838
_MANAGED_DIRS = "groups audit example-prod-networks monitor org_policies folders"
39+
_WORKER_POOL = ""
3940
}
4041

4142
depends_on = [
@@ -65,6 +66,7 @@ resource "google_cloudbuild_trigger" "plan_prod" {
6566
substitutions = {
6667
_TERRAFORM_ROOT = "terraform"
6768
_MANAGED_DIRS = "groups audit example-prod-networks monitor org_policies folders"
69+
_WORKER_POOL = ""
6870
}
6971

7072
depends_on = [
@@ -95,6 +97,7 @@ resource "google_cloudbuild_trigger" "apply_prod" {
9597
substitutions = {
9698
_TERRAFORM_ROOT = "terraform"
9799
_MANAGED_DIRS = "groups audit example-prod-networks monitor org_policies folders"
100+
_WORKER_POOL = ""
98101
}
99102

100103
depends_on = [

examples/tfengine/generated/team/cicd/configs/tf-apply.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ timeout: 21600s
1919
substitutions:
2020
_TERRAFORM_ROOT: "."
2121
_MANAGED_DIRS: ""
22+
_WORKER_POOL: ""
2223

2324
steps:
2425
- name: "gcr.io/cloud-foundation-cicd/cft/developer-tools-light@sha256:d881ce4ff2a73fa0877dd357af798a431a601b2ccfe5a140837bcb883cd3f011"
@@ -37,3 +38,7 @@ steps:
3738
args: ["./cicd/configs/run.sh", "-d", "${_MANAGED_DIRS}", "-a", "init", "-a", "plan", "-a", "apply -auto-approve"]
3839
dir: "${_TERRAFORM_ROOT}"
3940
id: Apply
41+
42+
options:
43+
pool:
44+
name: "${_WORKER_POOL}"

examples/tfengine/generated/team/cicd/configs/tf-plan.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ timeout: 1200s
1919
substitutions:
2020
_TERRAFORM_ROOT: "."
2121
_MANAGED_DIRS: ""
22+
_WORKER_POOL: ""
2223

2324
steps:
2425
- name: "gcr.io/cloud-foundation-cicd/cft/developer-tools-light@sha256:d881ce4ff2a73fa0877dd357af798a431a601b2ccfe5a140837bcb883cd3f011"
@@ -38,3 +39,7 @@ steps:
3839
args: ["./cicd/configs/tf-deletion-check.sh", "./cicd/configs/tf-deletion-allowlist.txt"]
3940
dir: "${_TERRAFORM_ROOT}"
4041
id: Resource deletion check
42+
43+
options:
44+
pool:
45+
name: "${_WORKER_POOL}"

0 commit comments

Comments
 (0)