Build in different project

 

 Hello group, I need some kind help. My working environment consists of two GCP projects, one for testing and one for production. I use source repositories for code, and cloud build to create builds. At the moment the builds all arrive on the test project (even the production ones). I would like to keep the pipeline in the test environment, but only for production builds, I would like them to come to me in the production project's Artifact registry. thanks to whoever will answer

0 1 550
1 REPLY 1

Hi @sergiomas,

Welcome to Google Cloud Community!

To deploy production builds to the Artifact Registry in the production project while deploying non-production builds to the Artifact Registry in the test project using Cloud Build, you need to create a trigger that only triggers builds for production changes and modify the build configuration to deploy to the appropriate Artifact Registry.

You can find detailed information on creating Cloud Build triggers in the official Cloud Build documentation: https://cloud.google.com/build/docs/automating-builds/create-manage-triggers

To authenticate to a specific project in your build configuration, you can use the gcloud auth command. Here is the documentation for authenticating to a specific project: https://cloud.google.com/sdk/gcloud/reference/auth/login

To push artifacts to the Artifact Registry, you can use the gcloud artifacts command. Here is the documentation for pushing artifacts to the Artifact Registry: https://cloud.google.com/artifact-registry/docs/manage-packages#gcloud-command-line-interface

These resources should provide you with everything you need to modify your Cloud Build pipeline to deploy production builds to the Artifact Registry in the production project while deploying non-production builds to the Artifact Registry in the test project.

Thanks