blob: 8d8fa1b3b52a9aaa3dff124707c69ae2b303af74 [file] [log] [blame]
# Copyright 2025 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
# Build by cloning https://go.googlesource.com/build at the given ${_SHA} commit.
steps:
# First, clone the repository. The default directory is /workspace.
- name: 'gcr.io/cloud-builders/git'
args: ['clone', 'https://go.googlesource.com/build', '/workspace']
# Then, check out the specific commit SHA provided.
- name: 'gcr.io/cloud-builders/git'
args: ['checkout', '${_SHA}']
# Now, build the Docker image from the checked-out source.
# The Docker build context is the root of the repository (/workspace).
- name: 'gcr.io/cloud-builders/docker'
args:
- 'build'
- '-f'
- 'cmd/${_SERVICE_NAME}/Dockerfile'
- '--build-arg'
- 'version=${_SHA}'
- '-t'
- 'gcr.io/${PROJECT_ID}/${_SERVICE_NAME}:${_SHA}'
- '-t'
- 'gcr.io/${PROJECT_ID}/${_SERVICE_NAME}:latest'
- '.'
# Finally, push the version-specific image.
- name: 'gcr.io/cloud-builders/docker'
args: ['push', 'gcr.io/${PROJECT_ID}/${_SERVICE_NAME}:${_SHA}']
images:
- 'gcr.io/${PROJECT_ID}/${_SERVICE_NAME}:${_SHA}'
- 'gcr.io/${PROJECT_ID}/${_SERVICE_NAME}:latest'
options:
logging: CLOUD_LOGGING_ONLY