1
votes

good day. I am new on GCP and wants to try Cloud Functions. I have a short experience in AWS Lambda.

My Problem: I am trying to find if it is possible for Cloud Build to deploy multiple Cloud Functions. In AWS, it has a SAM template were we could specify each lambda functions. Does GCP (or Cloud Build to be specific) also have support for this?

1

1 Answers

3
votes

Yes it is totally possible.

in gcp you deploy a cloud function with a cli tool called gcloud which is also available on cloud build, the command is basically this:

gcloud functions deploy NAME --runtime RUNTIME TRIGGER [FLAGS...]

in cloud build you just instruct the pipeline to use gcloud with those specific commands in order to deploy the functions you need, an example:

steps:
  - name: "gcr.io/cloud-builders/gcloud"
    args: ['functions ', 'deploy ', 'function1']
  - name: "gcr.io/cloud-builders/gcloud"
    args: ['functions ', 'deploy ', 'function2']
timeout: "1800s"