A large enterprise uses Cloud Build across multiple projects for different microservices. They want to create a centralized CI/CD governance where a single trigger can initiate builds across multiple projects, but each project's artifacts must be stored in a shared Artifact Registry. What is the best way to achieve this?
Trap 1: Use a shared VPC and a single Cloud Build private pool accessible…
Private pool shared, but triggers still per project; not centralized.
Trap 2: Use a single Cloud Build trigger in the governance project and…
Triggers cannot be cross-project directly; each project needs its own trigger.
Trap 3: Deploy a Cloud Function that listens to Cloud Source Repo events…
A Cloud Function triggered by Cloud Source Repo events would create separate builds in each project, but it cannot enforce centralised governance because each build operates independently with its own service account and permissions, failing to meet the requirement for a single trigger to orchestrate cross-project builds with shared artifact storage. This approach is tempting because it uses event-driven automation to react to code changes, which would be correct for triggering individual builds per project in a decentralised workflow where no central coordination is needed.
- A
Use a shared VPC and a single Cloud Build private pool accessible to all projects, and configure triggers in each project.
Why wrong: Private pool shared, but triggers still per project; not centralized.
- B
Create a Cloud Build trigger in the governance project that uses a service account with permissions to send build requests to other projects.
Cloud Build triggers can invoke builds in other projects using the 'projects/{projectId}/builds' resource with appropriate IAM.
- C
Use a single Cloud Build trigger in the governance project and configure triggers in each project to listen to Pub/Sub notifications from the governance trigger.
Why wrong: Triggers cannot be cross-project directly; each project needs its own trigger.
- D
Deploy a Cloud Function that listens to Cloud Source Repo events and creates Cloud Build builds in each project.
Why wrong: A Cloud Function triggered by Cloud Source Repo events would create separate builds in each project, but it cannot enforce centralised governance because each build operates independently with its own service account and permissions, failing to meet the requirement for a single trigger to orchestrate cross-project builds with shared artifact storage. This approach is tempting because it uses event-driven automation to react to code changes, which would be correct for triggering individual builds per project in a decentralised workflow where no central coordination is needed.