liveBook · Manning

Cloud Build

As explained in Google Anthos in Action

Cloud Build is a Google Cloud service that executes automated build, test, and deployment steps from source code.

Cloud Build is a managed, serverless Google Cloud CI/CD service that runs automated build, test, and deployment steps on Google infrastructure. It imports source from repositories or cloud storage, produces artifacts such as container images or Java Archives, and scales execution with demand. section 6.2.2 section 12.4.3

A Cloud Build pipeline provides:

  • Containerized steps defined in cloudbuild.yaml, using cloud builders for tools such as Docker, Git, or kubectl. section 12.4.3
  • Repository triggers that start builds from pushes or pull requests, including branch or tag conditions such as prod. section 6.2.2 section 12.4.3
  • Integrated access to repositories, registries, and workloads through the Google Cloud network, reducing build and deployment time. section 12.4.3
  • Package vulnerability scanning for Ubuntu, Debian, and Alpine containers, plus logs showing each build execution. section 6.2.2 section 6.2.2

Build, push, and deploy

A typical configuration runs unit tests, builds an image with the Docker builder, pushes it to a registry, and deploys it with kubectl or gke-deploy. Equivalent steps can deploy the image to managed Cloud Run or Cloud Run on Anthos.

# cloudbuild.yaml
steps:
# This step runs the unit tests on the app
- name: 'python:3.7-slim'
 id: Test
...
# This step builds the container image.
- name: 'gcr.io/cloud-builders/docker'
 id: Build
...
# This step pushes the image to a container registry
- name: 'gcr.io/cloud-builders/docker'
 id: Push
... 
# This step deploys the new version of our container image
- name: 'gcr.io/cloud-builders/kubectl'
 id: Deploy

Inspect a representative cloudbuild.yaml pipeline that separates testing, image construction, registry publication, and deployment into containerized steps. section 12.4.3

How Google Anthos in Action covers it

How deep it goes
Explains serverless execution, containerized pipeline steps, builders, triggers, commands, deployments, and local debugging.
Examples
Uses cloudbuild.yaml steps, gcloud builds submit, repository triggers, Docker image publication, and GKE or Cloud Run deployment.
What it assumes
Assumes familiarity with source repositories, container images, and Google Cloud deployment targets while showing configuration from pipeline steps.
What you can do after
Build and operate CI/CD pipelines that test, package, scan, publish, and deploy applications from repository changes.
How it connects
Connects CI/CD with containers, Docker, Kubernetes, Anthos, Cloud Run, repositories, registries, and Spinnaker.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Google Anthos in Action. The section links point to the parts of the book it draws on.