google-cloud-functionsgoogle-api-python-client

Deploy functions to Cloud Functions using Python


Is there a way to deploy scripts from a repository as GitHub to Cloud Functions with python without using docker or subprocess commands?

I tried this sample code that uses the CreateFunctionRequest method for deploying a function to CF, but there is no explanation on how defining the function itself.

Digging in the documentation I found that I need to specify a Function type and pass it as parameter for that method above.

The Function class has an attribute that defines the build config of the function. That attribute build_config is used to fetch the source code of the function.

However, it seems like the BuildConfig type only accepts deployment using docker, nothing like uploading a source code from GCS to CF as we have in gcloud commands.


Solution

  • Posting as an answer from my previous comment:

    Please check this documentation on deploying from Cloud Storage and deploying from a source repository. When you deploy your source code to Cloud Functions, it will be stored to Cloud Storage and will be built to a container image and it will be pushed to an image registry. Please check build process for your reference.