Continuous integration using Google Cloud Build

Cloud Build helps build software quickly across all languages. If your cloud provider is Google it's a better option compared to other CI providers out there.

Using Cloud Build it's really easy to create pipelines as part of your build steps to automate the deployment.

In this article, we would look into a very simple case, We configure cloud build to run our build on every time there is a commit to our Github Pull request.

Step 1. Build and debug your cloud build setup locally.

Step 2. Setup triggers in your project to trigger on every GitHub pull request commit.

Build and debug your cloud build setup locally.

First, let's clone our GitHub repo and run it locally.

git clone
cd my-node-example
npm install
npm test

After running the test command you must have seen, to make our example simple the project has only one API endpoints.

the API endpoints return the provider parameter name

We have written one test case to confirm its working as expected.

Now we would look into our cloudbuild.yaml file which would run defined steps every time it receives a pull request commit. To understand this file we need to know two things steps: contain the build steps that you want to run. name: point it to a container image to execute your task

cloud build file install and test -if test successful create docker images
  • esThe local build can build only on Linux and macOS. Please do install gcloud SDK to carry on this step.
//install the cloud-build-local
gcloud components install cloud-build-local
//run build locally.
cloud-build-local --config=cloudbuild.yaml --dryrun=false --substitutions=SHORT_SHA="demo" .

to know more about cloud build local

Now that we have validated our cloudbuild.yaml file let's configure the same in our google cloud project.

— Setup trigger in your project to trigger on every GitHub pull request commit.

Open the google cloud build page

connect repository

The next step is to select your source code provider and authenticate the repo. In this example, we are using Github repo.

select and authenticate Github repo.

Now setup the build trigger

As we see we have selected the trigger type as a Pull request and configure to trigger any change commit to the pull request.

That's it done!!!. Now every time we create a new branch from master and create a pull request or commit to pulling request. That would automatically trigger a build and our cloud build would make sure all test cases are passes through and create images for deployment.




full-time learner

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

CS373 Fall 2021 Entry 7: Justin Lee

Use Let’s Encrypt to Automate HTTPS for Your Kubernetes Cluster on Raspberry Pi

Raspberry Pi logo with lock next to it

Top 5 Sharing Platforms in Canada

How to create Streamlit apps in virtual environments, using Conda or Venv?

CS373 Spring 2022: Priyanka Barve

Avoid N+1 Problem In Graphql Federation With GO (Part 1)

My two theses on NFTs

Text Analytics in Microsoft Azure and Power BI

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
pravanjan palai

pravanjan palai

full-time learner

More from Medium

How to install Elasticsearch and Kibana version 8.1 on RHEL For Beginner

How to setup an NGINX reverse proxy on Google Cloud ☁️

Google Cloud Storage — Setup dynamic robots.txt file in NUXT with public Google Cloud Storage

Datadog: Monitoring Web Services