From 53647c5f5a547798f23ab4f42211f232cd55e083 Mon Sep 17 00:00:00 2001 From: Marcin Tojek Date: Mon, 28 Mar 2022 14:06:35 +0200 Subject: [PATCH] Use BUILD_TAG to tag cloud resources (#755) * Use REPO_BUILD_TAG to tag cloud resources * Fix * Fix * Fix * Fix * Fix * Use exec to call script * Address PR comments --- .../install/_static/Dockerfile.terraform_deployer | 3 ++- internal/install/_static/terraform_deployer.yml | 4 ++++ .../data_stream/compute/_dev/deploy/tf/compute.tf | 4 +++- .../gcp/data_stream/compute/_dev/deploy/tf/vars.tf | 12 ++++++++++++ 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/internal/install/_static/Dockerfile.terraform_deployer b/internal/install/_static/Dockerfile.terraform_deployer index a81dcc5b0..c467a3ace 100644 --- a/internal/install/_static/Dockerfile.terraform_deployer +++ b/internal/install/_static/Dockerfile.terraform_deployer @@ -20,6 +20,7 @@ HEALTHCHECK --timeout=3s CMD sh -c "[ -f /tmp/tf-applied ]" ENV TF_IN_AUTOMATION=true ENV TF_CLI_ARGS="-no-color" ADD run.sh / +RUN chmod +x /run.sh WORKDIR /workspace -ENTRYPOINT bash /run.sh +ENTRYPOINT exec /run.sh \ No newline at end of file diff --git a/internal/install/_static/terraform_deployer.yml b/internal/install/_static/terraform_deployer.yml index 356415e45..d0420b8f6 100644 --- a/internal/install/_static/terraform_deployer.yml +++ b/internal/install/_static/terraform_deployer.yml @@ -3,7 +3,11 @@ services: terraform: build: . tty: true + stop_grace_period: 5m environment: - TF_VAR_TEST_RUN_ID=${TF_VAR_TEST_RUN_ID:-detached} + - TF_VAR_REPO_NAME=${REPO_NAME:-unknown} + - TF_VAR_PULL_REQUEST=pr-${CHANGE_ID:-unknown} + - TF_VAR_CI_BUILD_NUMBER=${BUILD_NUMBER:-unknown} volumes: - ${TF_DIR}:/stage diff --git a/test/packages/parallel/gcp/data_stream/compute/_dev/deploy/tf/compute.tf b/test/packages/parallel/gcp/data_stream/compute/_dev/deploy/tf/compute.tf index b28ce78ae..34a15f83a 100644 --- a/test/packages/parallel/gcp/data_stream/compute/_dev/deploy/tf/compute.tf +++ b/test/packages/parallel/gcp/data_stream/compute/_dev/deploy/tf/compute.tf @@ -13,8 +13,10 @@ resource "google_compute_instance" "default" { zone = var.zone labels = { - team = "integrations" run_id = var.TEST_RUN_ID + repo_name = var.REPO_NAME + pull_request = var.PULL_REQUEST + ci_build_number = var.CI_BUILD_NUMBER } boot_disk { diff --git a/test/packages/parallel/gcp/data_stream/compute/_dev/deploy/tf/vars.tf b/test/packages/parallel/gcp/data_stream/compute/_dev/deploy/tf/vars.tf index 7b2d01706..b283122ec 100644 --- a/test/packages/parallel/gcp/data_stream/compute/_dev/deploy/tf/vars.tf +++ b/test/packages/parallel/gcp/data_stream/compute/_dev/deploy/tf/vars.tf @@ -2,6 +2,18 @@ variable "TEST_RUN_ID" { default = "detached" } +variable "REPO_NAME" { + default = "unknown-repo" +} + +variable "PULL_REQUEST" { + default = "unknown-pr" +} + +variable "CI_BUILD_NUMBER" { + default = "unknown-build" +} + variable "gcp_project_id" { type = string }