How to enable continuous integration with Google Cloud Build?

tudip-logo

Tudip

22 April 2020

What is Google Build?

In simple words, it is the service that executes your builds on GCP. It does so as build steps as build steps sequence, where each one is run by a builder image in a Docker container. It lets you create reliable, compatible and fast builds over all languages.

It’s not surprising that Google has given Cloud Build a cloud-native focus. Build targets include Docker containers, and you can use a build to automate deployments to Kubernetes-managed platforms. You don’t even need a separate configuration file to create a Docker image; all you need is a standard Dockerfile for your project. Making a Cloud Build config lets you add more steps to it, using YAML syntax to create the steps in the pipeline.

google-cloud-1-1024x538

Role of GitHub

“The release of the Cloud Build on GitHub Marketplace is the first step in an exciting partnership. Bringing your fully-managed continuous integration (CI) to the GitHub platform will provide fast, frictionless, and convenient CI for any repository on GitHub. GitHub and Google Cloud booth share an aim for developers productivity and we look forward to continuing to build on this partnership.” — Melody Meckfessel, Vice President of Engineering at Google Cloud.

Cloud Build provides you with a Cloud Build GitHub app that allows you to automatically build your code each and every time you push a new commit to GitHub. It can import source code from Cloud Source Repositories, Google Cloud Storage GitHub, or Bitbucket, execute a build to your specifications, and produce sufficient amounts.

GitHub can detect Dockerfiles in the root of a repo and automatically suggest you use a Continuous Integration (CI) tool like Cloud Build from GitHub Marketplace if one isn’t already set up.

google-cloud-2

Continuous Integration

Continuous Integration (CI) is a development practice where devs merge their code into a shared repository regularly. Each integration can then be checked & verified by an automated build and test. While automated testing is not a strict part of CI, it is typically implied.

With continuous integration, integrating new code gets done much earlier, not when all other participants have completed their sections. Instead, devs add their completed code to the mainline once or multiple times a day – the code is then open to all programmers.

Despite its positive points, continuous integration (CI) is often also considered to have some disadvantages in everyday working life. Although it saves you from a tedious integration phase at the end of the project and allows you to tackle problems early on, it can be very difficult for well-rehearsed teams to switch to continuous integration.
Some of the problems with the CI process are:

  • Its difficulty to maintain, where teams must build the proper testing suite and spend time writing test cases versus developing code
  • Conversion of familiar processes
  • Waiting times may occur when multiple developers want to integrate their code around the same time etc.

Simplify processes using Google Cloud Build

Developers often use more than one type of tool to build softwares. With the freedom and flexibility to integrate the right tools for the job, your team can work productively. And when the software development team is intelligent, accessible, and open, you can spend less time calibrating your tool chain and more time focusing on the work that matters most.

Suppose you need to create a continuous integration and delivery pipeline on GCP, when you push changes to the app repository and the Cloud Build pipeline can run tests, builds a container image, and pushes it to the Container Registry. After you push the image, Cloud Build updates the Deployment manifest and pushes it to the env repository. Using GitHub you can modify the mechanism before the deployment to use a Pull Request.

Cloud Build now uses the new Checks API, which is a better way to get feedback from integrations on your code. Once the build is complete, you can see rich status reports, annotated code, and detailed information—all without leaving GitHub.

Request a quote