Skip to content
This repository has been archived by the owner on Feb 24, 2023. It is now read-only.

artemrys/google-cloud-functions-deploy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bitbucket Pipelines Pipe: Google Cloud Function Deploy

Pipe to deploy a function to Google Cloud Function.

Packages

Packages are deployed to both Dockerhub and GitHub Packages:

YAML Definition

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]

Variables

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.

Prerequisites

  • An IAM user is configured with sufficient permissions to perform a deployment of your application using gcloud.
  • You have enabled APIs and services needed for your application.

Examples

Basic example:

- 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'

Advanced example:

- 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'

Testing

Test repository in Bitbucket is located here.

Releasing

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.

License

Copyright (c) 2022 Artem Rys. Apache 2.0 licensed, see LICENSE.txt file.