Viewing Build Results

This page explains how to view information about your Container Builder builds in Container Registry using the Google Cloud Platform Console, the gcloud command-line tool, and the Google Cloud Container Builder API.

Before you begin

Viewing build results

CONSOLE

In the GCP Console, the Build History menu can show you information about a build's status (such as success or failure), source, results, create time, images, and more.

To view the Build History menu:

  1. Open the Container Registry page in the Google Cloud Platform Console.

    Open the Container Registry page

  2. Select your project and click Open.

  3. In the left nav, click Build history.

    The Build history page is displayed, which shows a list of your recent builds.

To view details about a specific build:

  1. In the Build history page, click on a specific build.

    The Build details page is displayed, which shows the details of that build such as Status, Build Id, etc.

gcloud

The list command displays all images stored in Container Registry.

To view your build images, run the following command:

gcloud container images list

You should see an output similar to the following:

NAME
gcr.io/gcb-docs-project/quickstart-image
Only listing images in gcr.io/gcb-docs-project. Use
--repository to list images in other repositories.

To view details about a specific image, run the following command:

gcloud container images describe [IMAGE_NAME]

where [IMAGE_NAME] is the fully-qualified name of the image for which you want to get details.

You should see an output similar to the following:

image_summary:
digest: sha256:7bf8b6ec3b3ee238fa92147ce37cf9d3528bbd09908ef2ba60544d154bffec62
fully_qualified_digest: gcr.io/gcb-docs-project/quickstart-image@sha256:7bf8b6ec3b3ee238fa92147ce37cf9d3528bbd09908ef2ba60544d154bffec62
registry: gcr.io
repository: gcb-docs-project/quickstart-image

Filtering build results using queries

To find information for builds that fit specific criteria, supply a query string in the Filter Builds field in the Build history page in Google Cloud Platform Console. For example, you can query for builds that have failed (that have a FAILURE value in the status field), builds that were created after a certain time, tagged builds, and other such conditions.

Supported fields for queries

You can query for builds based on the values of the following fields:

  • status
  • build_id
  • trigger_id
  • source.storage_source.bucket
  • source.storage_source.object
  • source.repo_source.repo_name
  • source.repo_source.branch_name
  • source.repo_source.tag_name
  • source.repo_source.commit_sha
  • source_provenance.resolved_repo_source.commit_sha
  • results.images.name
  • results.images.digest
  • options.requested_verify_option
  • tags
  • images
  • create_time
  • start_time
  • finish_time

Fields listed with dot notation (.) are subfields.

Constructing a query string

Query strings use the general form:

field="value"

Use dot notation to specify a subfield, such as results.images.name. Queries support the = and != comparison operators, as well as >, >=, <, and <= for fields that have numeric values (such as create_time).

You can create compound queries by using the boolean AND and OR expressions.

Common example queries

To query for all successful builds:

status="SUCCESS"

To query for all builds that have yet to finish:

status="QUEUED" OR status="WORKING"

To query for builds with a given result image name:

(status="SUCCESS" OR status="FAILURE") AND \
    results.images.name="gcr.io/argo-integration-testing/stubby-probe"

To query for all builds with the tag "prod":

tags="prod"

To query for builds marked as verified:

options.requested_verify_option="VERIFIED"

To query for builds that come from a source in Cloud Storage (as opposed to a Cloud Source Repository):

source.storage_source.bucket!=""

To query for builds with a given result digest:

results.images.digest="sha256:6c7147fe4c813845ac2a9aa6f937bb272b68784f647c4f64c7325723c7245c88"

To query for builds started after a specific time and finished before a specific time (UTC timezone):

create_time>"2016-10-12T18:43:49" AND finish_time<"2016-10-13T18:43:49"

Filtering build results using tags

You can use tags in your config files, which allows you to organize your builds into groups and to filter your builds. You can specify strings in tags, such as "prod" or "test".

Tags have the following limitations:

  • Each tag's character limit is 128 characters
  • You can define a maximum of 64 tags per build
  • Tags can contain letters, numbers, and underscores

To add tags in your build:

  1. In your build config file, add the tags field:

    steps:
    - name: 'gcr.io/cloud-builders/docker'
      args: [ 'build', '-t', 'gcr.io/$PROJECT_ID/cb-demo-img', '.' ]
    images:
    - 'gcr.io/$PROJECT_ID/cb-demo-img'
    tags:
    - "test"
    - "tag2"
    
  2. To see tagged builds in your cluster, use the --filter option in gcloud container builds list. For example, the following command lists all builds tagged with 'test':

    gcloud container builds list --filter "tags='test'"
    

    You will see an output similar to the following:

    ID                                    CREATE_TIME                DURATION  SOURCE                                                                             IMAGES                                 STATUS
    d33a9895-...                          ...                        1M45S     gs://...                                                                           gcr.io/...                             SUCCESS
    

What's next

Send feedback about...

Cloud Container Builder