Reputation: 135
We are attempting to deploy Firebase Functions, Rules, and Indexes to multiple projects for tenant isolation of data. We are attempting to use Google Cloud Source Repository, but Cloud Build in each project does not have the ability to connect to the Central Project Source Repository - and we have added the required Source Repo IAM rules on our Cloud Build service account.
What is a good solution for deploying our Firebase Functions, Rules, and Indexes from a central repository?
Upvotes: 1
Views: 108
Reputation: 75910
You can't access to event from a source repository in another project mode. Thereby, you can't set up a trigger on the source repository that don't belong to your project
So, you can imagine this workaround to achieve what you want
Source Project
push-event
for example)push-event
topicTenant Projects
push-event
topic located in the source projet (be sure that the current account that run the terraform has the roles topicViewer and topicSubscriber on the push-event
topic (or on the source project))Note: the first thing that you have to do in the Cloud Build execution is to clone the source repository because you won't have the data automatically downloaded (get the correct source according with the branch, tag or pull event.)
Cloud Functions
I don't know your dev language, but the principle is to perform an API call to the Cloud Build API to launch the build. This API call require the content of the cloudbuild.json
. So, in the cloud function,
/tmp
directory and then read the cloudbuild.json
file to run in your Cloud Build. But it could be difficult in case of branch, tag, or pull context.Upvotes: 1