简体   繁体   English

谷歌云构建构建步骤的“显示名称”

[英]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.目前显示的是“名称”字段,用于指示容器图像,并不是一种非常有用的传达含义的方式。

The id field worked for me. id字段对我有用。 I have a cloudbuild.yaml file as below:我有一个cloudbuild.yaml文件如下:

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这是将在没有id字段的构建详细信息中显示的内容没有 id 字段的构建详细信息

This is the build details after the id fields are added:这是添加id字段后的构建详细信息: 在此处输入图像描述

Link to the id field in the official doc 链接到官方文档中的id字段

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.经过一些测试后发现,“id”字段在每个步骤的构建详细信息中都“按原样”显示,并且可以用作控制台中显示的字段。 Note though that substitutions (ie ${QQQ} ) did not work for me in the 'id' field请注意,虽然替换(即${QQQ} )在“id”字段中对我不起作用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM