This repository contains source code for custom builders. You can use these images as build steps for Google Cloud Build.
These are not official Google products.
Google Cloud Build executes a build as a series of build steps. Each build step is run in a Docker container. See the Cloud Build documentation for more details about builds and build steps.
- Select or create a Google Cloud project.
- Enable billing for your project.
- Enable the Cloud Build API.
- Install and initialize the Cloud SDK.
To use a customer builder as a build step, you need to download the source code from this repo and build the image.
The example below shows how to download and build the image for the cdxgen
build step on a Linux or Mac OS X workstation:
-
Clone the
cloud-builders-community
repo:$ git clone https://github.com/CloudBuildr/google-custom-builders
-
Go to the directory that has the source code for the
cdxgen
Docker image:$ cd google-custom-builders/cdxgen
-
Build the Docker image:
$ gcloud builds submit --config cloudbuild.yaml .
-
View the image in Google Container Registry:
$ gcloud container images list --filter cdxgen
Once you've built the Docker image, you can use it as a build step in a Cloud Build build.
For example, below is the cdxgen
build step in a YAML
config file, ready to be used in a Cloud Build build:
steps:
- name: "gcr.io/$PROJECT_ID/cdxgen"
args: ["--output", "bom.xml", "src"]
The custom builders gets cached and stored in the container registry that belongs to the project. As the tools change it may become necessary to update the builders in your registry. To update simply run build docker image
step again.
```
$ gcloud builds submit --config cloudbuild.yaml .
```