From 6f5704aec064e09f0effa90ce12fe0a7c7649158 Mon Sep 17 00:00:00 2001 From: Philippe Boneff Date: Thu, 29 Oct 2026 12:34:26 +0000 Subject: [PATCH] Remove unused staging Cloud Build and preloader modules These modules were only used by the Arche staging log configs, removed in #977. cloudbuild/tesseract also builds cmd/tesseract/gcp/staging/Dockerfile, which #977 deleted. Follow-up to #790. --- .../modules/gcp/cloudbuild/preloader/main.tf | 126 ------------ .../gcp/cloudbuild/preloader/variables.tf | 44 ----- .../modules/gcp/cloudbuild/tesseract/main.tf | 186 ------------------ .../gcp/cloudbuild/tesseract/variables.tf | 34 ---- deployment/modules/gcp/gce/preloader/main.tf | 114 ----------- .../modules/gcp/gce/preloader/variables.tf | 45 ----- 6 files changed, 549 deletions(-) delete mode 100644 deployment/modules/gcp/cloudbuild/preloader/main.tf delete mode 100644 deployment/modules/gcp/cloudbuild/preloader/variables.tf delete mode 100644 deployment/modules/gcp/cloudbuild/tesseract/main.tf delete mode 100644 deployment/modules/gcp/cloudbuild/tesseract/variables.tf delete mode 100644 deployment/modules/gcp/gce/preloader/main.tf delete mode 100644 deployment/modules/gcp/gce/preloader/variables.tf diff --git a/deployment/modules/gcp/cloudbuild/preloader/main.tf b/deployment/modules/gcp/cloudbuild/preloader/main.tf deleted file mode 100644 index 007033da6..000000000 --- a/deployment/modules/gcp/cloudbuild/preloader/main.tf +++ /dev/null @@ -1,126 +0,0 @@ -terraform { - backend "gcs" {} - - required_providers { - google = { - source = "hashicorp/google" - version = "6.50.0" - } - } -} - -# Cloud Build - -locals { - cloudbuild_service_account = "cloudbuild-${var.env}-sa@${var.project_id}.iam.gserviceaccount.com" - scheduler_service_account = "scheduler-${var.env}-sa@${var.project_id}.iam.gserviceaccount.com" -} - -resource "google_project_service" "cloudbuild_api" { - service = "cloudbuild.googleapis.com" - disable_on_destroy = false -} - -## Service usage API is required on the project to enable APIs. -## https://cloud.google.com/apis/docs/getting-started#enabling_apis -## serviceusage.googleapis.com acts as a central point for managing the API -## lifecycle within your project. By ensuring the required APIs are enabled -## and accessible, it allows Cloud Build to function seamlessly and interact -## with other Google Cloud services as needed. -## -## The Cloud Build service account also needs roles/serviceusage.serviceUsageViewer. -resource "google_project_service" "serviceusage_api" { - service = "serviceusage.googleapis.com" - disable_on_destroy = false -} - -resource "google_cloudbuild_trigger" "preloader_trigger" { - name = "preloader-${var.base_name}" - service_account = "projects/${var.project_id}/serviceAccounts/${local.cloudbuild_service_account}" - location = var.location - - # TODO(phboneff): use a better mechanism to trigger releases that re-uses Docker containters, or based on branches rather. - # This is a temporary mechanism to speed up development. - github { - owner = var.github_owner - name = "tesseract" - push { - tag = "^staging-deploy-(.+)$" - } - } - - build { - ## Since TesseraCT's infrastructure is not publicly accessible, we need to use - ## bearer tokens for the test to access them. - ## This step creates those, and stores them for later use. - step { - id = "bearer_token" - name = "gcr.io/cloud-builders/gcloud" - script = < /workspace/cb_access - curl -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/${local.cloudbuild_service_account}/identity?audience=${var.submission_url}" > /workspace/cb_identity - EOT - } - - ## TODO(phboneff): move to its own container / cloudrun / batch job. - ## Preload entries. - ## Leave enough time for the preloader to run, until the token expires. - ## Stop after 360k entries, this is what gets copied within 60 minutes. - timeout = "4200s" // 60 minutes - step { - id = "ct_preloader" - name = "golang" - script = <&1 - EOT - dir = tg_path.value - env = [ - "GOOGLE_PROJECT=${var.project_id}", - "TF_IN_AUTOMATION=1", - "TF_INPUT=false", - "TF_VAR_project_id=${var.project_id}", - "DOCKER_CONTAINER_TAG=$SHORT_SHA" - ] - wait_for = ["prepare_terragrunt_opentofu_container", "docker_push_tesseract_gcp"] - } - } - - ## Print terraform output. - dynamic "step" { - for_each = var.logs_terragrunts - iterator = tg_path - - content { - id = "terraform_print_output_${tg_path.key}" - name = "terragrunt-opentofu" - script = < /workspace/tesseract_url - terragrunt --terragrunt-no-color output --raw tesseract_bucket_name -no-color > /workspace/tesseract_bucket_name - terragrunt --terragrunt-no-color output --raw ecdsa_p256_public_key_data -no-color > /workspace/tesseract_log_public_key.pem - cat /workspace/tesseract_url - cat /workspace/tesseract_bucket_name - cat /workspace/tesseract_log_public_key.pem - EOT - dir = tg_path.value - env = [ - "GOOGLE_PROJECT=${var.project_id}", - "TF_IN_AUTOMATION=1", - "TF_INPUT=false", - "TF_VAR_project_id=${var.project_id}", - "DOCKER_CONTAINER_TAG=$SHORT_SHA" - ] - wait_for = ["terraform_apply_tesseract_${tg_path.key}"] - } - } - - options { - logging = "CLOUD_LOGGING_ONLY" - machine_type = "E2_HIGHCPU_8" - } - } - - depends_on = [ - module.artifactregistry - ] -} diff --git a/deployment/modules/gcp/cloudbuild/tesseract/variables.tf b/deployment/modules/gcp/cloudbuild/tesseract/variables.tf deleted file mode 100644 index 9be20f5c4..000000000 --- a/deployment/modules/gcp/cloudbuild/tesseract/variables.tf +++ /dev/null @@ -1,34 +0,0 @@ -variable "project_id" { - description = "GCP project ID where the log is hosted" - type = string -} - -variable "location" { - description = "Location in which to create resources" - type = string -} - -variable "env" { - description = "Unique identifier for the env, e.g. dev or ci or prod" - type = string -} - -variable "docker_env" { - description = "Unique identifier for the Docker env, e.g. dev or ci or prod" - type = string -} - -variable "github_owner" { - description = "GitHub owner used in Cloud Build trigger repository mapping" - type = string -} - -variable "logs_terragrunts" { - description = "Paths of the log terragrunt configs to deploy, from the root of the repository" - type = list(any) -} - -variable "git_tag_trigger_regexp" { - description = "Regular expression Git tags must match to trigger a build" - type = string -} diff --git a/deployment/modules/gcp/gce/preloader/main.tf b/deployment/modules/gcp/gce/preloader/main.tf deleted file mode 100644 index c149668ff..000000000 --- a/deployment/modules/gcp/gce/preloader/main.tf +++ /dev/null @@ -1,114 +0,0 @@ -terraform { - backend "gcs" {} - required_providers { - google = { - source = "hashicorp/google" - version = "6.50.0" - } - } -} - -locals { - preloader_service_account_id = var.env == "" ? "preloader-sa" : "preloader-${var.env}-sa" - - preloader_container_name = "preloader-${var.env}" - - # docker_run_args are provided to the docker run command. - # Use this to configure docker-specific things. - docker_run_args = join(" ", compact([ - # Ensure that TesseraCT logs are delivered to GCP logging. - "--log-driver=gcplogs", - ])) - - # Args for the preloader command. - preloader_args = join(" ", [ - "--target_log_uri=${var.target_log_uri}", - "--source_log_uri=${var.source_log_uri}", - "--start_index=${var.start_index}", - "--continuous=true", - "--num_workers=500", - "--parallel_fetch=20", - "--parallel_submit=1500", - "--v=2", - ]) - - preloader_cloud_init = <