Pipe to deploy a function to Google Cloud Function.
Packages are deployed to both Dockerhub and GitHub Packages:
Add the following snippet to the script section of your bitbucket-pipelines.yml
file:
- pipe: docker://artemrys/google-cloud-functions-deploy:latest
variables:
KEY_FILE: '<string>'
PROJECT: '<string>'
FUNCTION_NAME: '<string>'
ENTRY_POINT: '<string>'
RUNTIME: '<string>'
# MEMORY: '<string>' [Optional]
# TIMEOUT: '<string>' [Optional]
# EXTRA_ARGS: '<string>' [Optional]
# DEBUG: '<string>' [Optional]
# SOURCE: '<string>' [Optional]
# TRIGGER: '<string>' [Optional]
Variable | Usage |
---|---|
KEY_FILE (*) | Key file for a Google service account. |
PROJECT (*) | The Project ID of the project that owns the app to deploy. |
FUNCTION_NAME (*) | The name of the function in Google Cloud Function. |
ENTRY_POINT (*) | The deployed Cloud Function will use a function named ENTRY_POINT in the source file. |
RUNTIME (*) | The runtime of the Cloud Function. |
MEMORY | The memory limit of the Cloud Function. |
TIMEOUT | The timeout of the Cloud Function. |
EXTRA_ARGS | Extra arguments to be passed to the CLI. |
DEBUG | Turn on extra debug information. Default false . |
SOURCE | Path to the source of the Google Cloud Function. Default '.' |
TRIGGER | Trigger command-line flag. More details Default '--trigger-http'. |
(*) = required variable.
- pipe: docker://artemrys/google-cloud-functions-deploy:latest
variables:
KEY_FILE: $KEY_FILE
PROJECT: 'my-project'
FUNCTION_NAME: 'hello_world'
ENTRY_POINT: 'hello_world'
RUNTIME: 'python37'
- pipe: docker://artemrys/google-cloud-functions-deploy:latest
variables:
KEY_FILE: $KEY_FILE
PROJECT: 'my-project'
FUNCTION_NAME: 'hello_world'
ENTRY_POINT: 'hello_world'
RUNTIME: 'python37'
MEMORY: '256MB'
TIMEOUT: '60'
EXTRA_ARGS: '--logging=debug'
Test repository in Bitbucket is located here.
To release a new version of the image to both GitHub Packages and Dockerhub, you just need to tag a specific commit and push it to the repository. GitHub Actions job will do the rest.
Copyright (c) 2022 Artem Rys. Apache 2.0 licensed, see LICENSE.txt file.