Build Triggers

You can ensure that the container images you build are up-to-date by creating a build trigger. A build trigger instructs Container Builder to automatically build your image whenever there are changes pushed to the build source. You can set a build trigger to re-build your images on any changes to the source repository, or only changes that match certain criteria.

Build triggers can help ensure that your container images are always based on the latest version of their source code. They're also useful for building and testing feature branches prior to release or for automating the workflows that produce your container images.

Creating a build trigger

To create a new build trigger:

  1. Navigate to Container Registry's build triggers menu in Cloud Platform Console.
  2. Click Add trigger.

You'll be prompted to select the host repository for your build source. Valid options can include:

Select the source type and click Continue. You should see a list of available repositories. Select the desired repository, then click Continue.

You'll see a list of trigger settings:

  • Trigger Name: An optional name for your trigger.
  • Trigger Type: You can set a trigger to start a build on commits to a particular branch, or on commits that contain a particular tag. In either case, you can specify a regular expression with the branch or tag value to match.
  • Build Configuration: The Dockerfile or cloudbuild file (located in the remote repository) to use for each build that the trigger starts.

Using a Dockerfile

To use a Dockerfile for your build configuration, you'll need to specify the Dockerfile directory and supply a name for the resulting image.

When you've provided the Dockerfile and image name, you'll see a preview of the docker build command that your build will execute and a summary of the trigger configuration. Click Create trigger to save the build trigger.

Using a build request file

To use a build request file for your build configuration, you'll need to provide the location of a build request file.

Once you've set the location, you'll see a summary of the trigger. Click Create trigger to save the build trigger.

Testing a build trigger

To manually test a build trigger, click Run trigger on your trigger's entry in the triggers list.

Skipping a build trigger

In some cases, you may want to make a change to your source code but you don't want to trigger a build. For example, you might not want to trigger a build when you update documentation or configuration files.

In such scenarios, you can include [skip ci] or [ci skip] in the commit message, and a build will not be triggered.

If you want to run a build on that commit later, use the Run trigger button.

Monitor your resources on the go

Get the Google Cloud Console app to help you manage your projects.

Send feedback about...

Cloud Container Builder Documentation