Cloud Build is a service that executes your builds on Google Cloud Platform's infrastructure.
Cloud Build can import source code from a variety of repositories or cloud storage spaces, execute a build to your specifications, and produce artifacts such as Docker containers or Java archives.
Build configuration and build steps
You can write a build config to provide instructions to Cloud Build on what tasks to perform. You can configure builds to fetch dependencies, run unit tests, static analyses, and integration tests, and create artifacts with build tools such as docker, gradle, maven, bazel, and gulp.
Cloud Build executes your build as a series of build steps, where each build step is run in a Docker container. Executing build steps is analogous to executing commands in a script.
You can either use the build steps provided by Cloud Build and the Cloud Build community, or write your own custom build steps:
Build steps provided by Cloud Build: Cloud Build has published a set of supported open-source build steps for common languages and tasks.
Community-contributed build steps: The Cloud Build user community has provided open-source build steps.
Custom build steps: You can create your own build steps for use in your builds.
Each build step is run with its container attached to a local Docker network
cloudbuild. This allows build steps to communicate with each other and
You can manually start
Cloud Build using the
gcloud command-line tool or the
use Cloud Build's build
triggers feature to
create an automated continuous integration/continuous delivery (CI/CD) workflow
that starts new builds in response to code changes.
You can integrate build triggers with many code repositories, including Cloud Source Repositories, GitHub, and Bitbucket.
Viewing build results
You can view your build results using the
gcloud tool, the
API or use the
Build History page in the Cloud Build section in
Cloud Console, which displays details and logs for every build
Cloud Build executes. For instructions see Viewing Build
How builds work
The following steps describe, in general, the lifecycle of a Cloud Build build:
- Prepare your application code and any needed assets.
- Create a build config file in YAML or JSON format, which contains instructions for Cloud Build.
- Submit the build to Cloud Build.
- Cloud Build executes your build based on the build config you provided.
- If applicable, any built images are pushed to Container Registry. Container Registry provides secure, private Docker image storage on Google Cloud.
Cloud Build interfaces
You can use Cloud Build with the Google Cloud Console,
command-line tool, or Cloud Build's REST API.
In the Cloud Console, you can view the Cloud Build build results in the Build History page, and automate builds in Build Triggers.
You can request builds using the Cloud Build REST API.
As with other Cloud Platform APIs, you must authorize access using OAuth2. After you have authorized access, you can then use the API to start new builds, view build status and details, list builds per project, and cancel builds that are currently in process.
For more information, see the API documentation.
Running builds locally
If you want to test your build before submitting it to Cloud Build,
you can run your build locally using the
cloud-build-local tool. For
instructions on using this tool see the Building and Debugging