If you prefer to deploy your function source code from a source repository like GitHub or Bitbucket, you can use Google Cloud Source Repositories to deploy functions directly from branches or tags in your repository.
Set up Cloud Source Repositories
- Follow the Cloud Source Repositories getting started steps to set up your repository.
- Connect your GitHub or Bitbucket repository by following the hosted repository guide.
Once the connection between Cloud Source Repositories and your external repository is established, these repositories are kept synchronized so that you can commit to your chosen repository as you would normally.
Deploy using the gcloud tool
To deploy a function from your source repo, use the
--source command line
argument. For example:
gcloud beta functions deploy <NAME> \ --source https://source.developers.google.com/projects/<PROJECT_ID>/repos/<REPOSITORY_ID>/moveable-aliases/master/paths/<SOURCE> \ <TRIGGER>
The following table describes common
gcloud beta functions deploy arguments:
||The Cloud Functions command you are executing, in this case the
||The name of the Cloud Function you are deploying. This name can only contain letters, numbers, underscores, and hyphens. Unless you specify the
||The location of the source code to deploy. The location can be source code in Google Cloud Storage, a reference to a source repository, or a local filesystem path. For usage details, see the gcloud Command Reference.|
||The trigger type for this function (see Calling Cloud Functions).|
||The name of a function that should be used as an entry point, instead of the