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
