nsof
nsof

Reputation: 3049

Google cloud build "display name" for build steps

Is there a way to provide a "display name" for steps that would be shown in the build details of the build history? What is currently display is the "name" field which is used to indicate the container image and is not a very useful way to convey meaning.

Upvotes: 6

Views: 1150

Answers (2)

Son Nguyen
Son Nguyen

Reputation: 4316

The id field worked for me. I have a cloudbuild.yaml file as below:

steps:
  - id: 'build-container-image'
    name: 'gcr.io/cloud-builders/docker'
    args:
      - 'build'
      - '--network=cloudbuild'
      - '-t'
      - '${_REGION_NAME}-docker.pkg.dev/$PROJECT_ID/${_REPO_NAME}/${_SERVICE_NAME}'
      - '.'

  - id: 'push-image-to-artifact-registry'
    name: 'gcr.io/cloud-builders/docker'
    args:
      - 'push'
      - '${_REGION_NAME}-docker.pkg.dev/$PROJECT_ID/${_REPO_NAME}/${_SERVICE_NAME}'

  - id: 'deploy-image-to-cloud-run'
    name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
    entrypoint: gcloud
    args:
      - 'run'
      - 'deploy'
      - '${_SERVICE_NAME}'
      - '--image'
      - '${_REGION_NAME}-docker.pkg.dev/$PROJECT_ID/${_REPO_NAME}/${_SERVICE_NAME}'
      - '--region'
      - '${_REGION_NAME}'
      - '--platform'
      - 'managed'
      - '--allow-unauthenticated'
substitutions:
  _REGION_NAME: us-west1
  _REPO_NAME: container-images
  _SERVICE_NAME: public-web-cloud-run
images:
  - '${_REGION_NAME}-docker.pkg.dev/$PROJECT_ID/${_REPO_NAME}/${_SERVICE_NAME}'

This is what will be shown in the build details without the id field Build details without id field

This is the build details after the id fields are added: enter image description here

Link to the id field in the official doc

Upvotes: 5

nsof
nsof

Reputation: 3049

Found out after some tests that the "id" field is presented 'as is' in the build details for each step and can be used as a field that is presented in the console. Note though that substitutions (i.e. ${QQQ}) did not work for me in the 'id' field

Upvotes: 0

Related Questions