Search code examples
google-cloud-platformgoogle-cloud-rungoogle-cloud-source-repos

Can Google Cloud Repositories be shared cross projects?


I am trying to set up a continous developemnt system for creating an app and I would like to know if this is idea is feasible within GCP:

Project A - Hosts Cloud Source Repository

Project B - Cloud Run for the app

On project B, I have the Cloud Run option of 'Continously deploy new revisions from a source repository' which I would like to point to the CSR from project A.

My question is, Can CSR be shared cross-project or do I need to go for GitHub or BitBucket to be able to share code between projects?


Solution

  • You can access y our Cloud Source Repository from any project as long as your account (service or user) has the permission to access it.

    However, you can't configure Cloud Build triggers on Cloud Source Repository that is in another project (the continuous deployment on Cloud Run configure a Cloud Build trigger behind the scene for you. It's simply a shortcut).


    But you can also create a Cloud Build Trigger in your Cloud Source Repository project and grant the permission to the Cloud Build service account to deploy the Cloud Run service to the target project.

    Because the continuous deployment on Cloud Run is a shortcut to configure Cloud Build trigger and deployment pipeline, you can do the same manually (longer and required more skill/experience with GCP), but it's not impossible!!