faas-cicd

module
v0.0.0-...-3585554 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 2, 2020 License: MIT

README


title: Deploy a Cloud Function with Cloud Build description: Use Cloud Build to continuously deploy a Cloud Function. author: montao tags: Cloud Functions, GitHub, GoLang, continuous integration, continuous delivery, continuous deployment date_published: 2020-07-29

Niklas Rosencrantz | DevOps/SRE

Introduction

This tutorial demonstrates how to create and deploy a Cloud Function with Cloud Build.

Objectives

  • Use Cloud Build to deploy a Cloud Function.
  • Use code written in the Go programming language to process incoming HTTP requests.

Set up your environment

  1. Create a project in the Cloud Console.

  2. Enable billing for your project.

  3. Create a GitHub repository for your project.

  4. Enable the Cloud Functions API:

    gcloud services enable cloudfunctions.googleapis.com
    
  5. Add the Cloud Build GitHub app to your GitHub account and repository.

  6. Create the directory and file structure in the GitHub repository.

    You can use the file tree from the source for this tutorial as a starting point.

    Put a file named cloudbuild.yaml in the root directory and the code for the Cloud Function in a separate directory, as in the following file tree:

    │   .gitignore
    │   cloudbuild.yaml
    └───code
            function.go
    

Connect the repository with Cloud Build

  1. In the Cloud Console, go to the Cloud Build page.
  2. Choose Triggers.
  3. Click Connect repository.
  4. Create a push trigger so that Cloud Build will run when you push to the master branch.

After you have connected the repository with Cloud Build, Cloud Build will run, build, test, and deploy your Cloud Function each time you push to the repository.

You can view a list of your builds on the Cloud Builds page of the Cloud Console.

Or this contribution, based on my project https://github.com/GoogleCloudPlatform/community/tree/master/tutorials/cloud-functions-cloudbuild

Directories

Path Synopsis
Package p contains an HTTP Cloud Function.
Package p contains an HTTP Cloud Function.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL