Ensure that the account has at least the following IAM roles:
It's advised to add environment name to the bucket name to avoid collisions with other environments.
DEV NOTE: GCP Cloud shell can be used for deployment. It has all required software pre-installed.
beam/learning/tour-of-beam/cloudbuild/common.tfvars
. Place the values listed below into the file, adjusting them as needed:project_id = “apache-beam-testing” # GCP project ID tourofbeam_deploy_sa = “tourofbeam-cb-deploy-env” # Service account for Initialize-Playground-environment trigger tourofbeam_ci_sa = “tourofbeam-cb-ci-env” # Service account for CI trigger tourofbeam_cd_sa = “tourofbeam-cb-cd-env” # Service account for CD trigger environment_name = “env” # Environment name playground_dns_name = “fqdn.beam.apache.org” # Playground DNS name pg_region = “us-west1” # Playground region pg_gke_zone = “us-west1-a” # Playground GKE zone pg_gke_name = “cluster_name” # Playground GKE cluster name pg_datastore_namespace = “env” # Playground Datastore namespace name tourofbeam_deployment_state_bucket = “tourofbeam-deployment-state-env” # Bucket for Terraform state for deployment webhook_trigger_secret_id = “secret-cloudbuild-triggers-webhook” # Secret ID for webhook trigger gh_pat_secret_id = “github_pat_playground_deployment” # Secret ID for GitHub PAT tourofbeam_deploy_trigger_name = “TourOfBeam-Deploy-Update-env” # Trigger name for deployment trigger tourofbeam_ci_trigger_name = “TourOfBeam-CI-env” # Trigger name for CI trigger tourofbeam_cd_trigger_name = “TourOfBeam-CD-env” # Trigger name for CD trigger tourofbeam_cb_private_bucket = “tourofbeam-cb-private-logs-env” # Bucket for Cloud Build private logs tourofbeam_cb_public_bucket = “tourofbeam-cb-public-logs-env” # Bucket for Cloud Build public logs web_app_id = “Tour-Of-Beam” = “tour-of-beam” # Web app ID
If you plan to have only one environment, you can use simple resource names like tourofbeam-deployment-state
or tourofbeam-cb-private-logs
instead of tourofbeam-deployment-state-env
or tourofbeam-cb-private-logs-env
. But if you plan to have multiple environments, it's advised to add environment name to the resource name to avoid collisions with other environments.
The beam/learning/tour-of-beam/cloudbuild/01.setup
provisions dependencies required to set up Cloud Build for Tour of Beam:
# Create a new authentication configuration for GCP Project with the created user account gcloud init # Command imports new user account credentials into Application Default Credentials gcloud auth application-default login # Navigate to 01.setup directory cd beam/learning/tour-of-beam/cloudbuild/01.setup # Run terraform commands terraform init -backend-config="bucket=\<tourofbeam-triggers-state-env\> terraform apply -var="project_id=$(gcloud config get-value project)" -var-file="../common.tfvars"
Follow Connect to a GitHub repository to connect GitHub repository with GCP Cloud Build.
The beam/learning/tour-of-beam/cloudbuild/02.builders
provisions:
# Navigate to beam/learning/tour-of-beam/cloudbuild/02.builders directory cd ../02.builders # Run terraform commands and provide required values terraform init -backend-config="bucket=\<tourofbeam-triggers-state-env\>" terraform apply -var="project_id=$(gcloud config get-value project)" -var-file="../common.tfvars"
TourOfBeam-Deploy-Update-env
.Source
- Repository
to ensure that Default GitHub repository is connected.CONNECT NEW REPOSITORY
in case it was not automatically connected.Save
and Run the trigger.TourOfBeam-CD-env-manual
.Source
- Repository
to ensure that Default GitHub repository is connected.CONNECT NEW REPOSITORY
in case it was not automatically connected.Save
and Run the trigger.