Google Cloud Functions allows you to deploy
small logical units of code (i.e. functions).
While it is already possible to deploy these functions from a
Google Cloud Storage bucket
or directly from the inline editor (e.g. for prototyping purposes),
did you know that you can take advantage of
Google Cloud Repository
to host the Cloud Functions source code and automate these deployments?
You could for instance trigger a new deploy after each
Let’s see how.
We’ll assume you already have a working Google Cloud Repository (how to setup a Cloud Repository) with the following configuration:
- repository name:
- myrepo branch:
- function name:
The repository URL should look like this:
Deploying from this repository is quite easy:
$ gcloud beta functions deploy fnName \ --source https://source.developers.google.com/projects/project123/repos/myrepo/moveable-aliases/master \ --entry-point fnName --trigger-http
Note: Please note that the
--source URL used to deploy the function is different from the repository URL!