在Google Cloud Builder中获取标签

qua*_*ben 8 google-compute-engine google-container-registry

在新创建的Google容器构建器中,我无法在构建期间获取git标记.在构建过程中,默认克隆似乎不会获取git标记.我添加了一个调用的自定义构建过程,git fetch --tags但这会导致错误:

Fetching origin git: 'credential-gcloud.sh' is not a git command. See 'git --help'. fatal: could not read Username for 'https://source.developers.google.com': No such device or address

# cloudbuild.yaml
#!/bin/bash

openssl aes-256-cbc -k "$ENC_TOKEN" -in gcr_env_vars.sh.enc -out gcr_env_vars.sh -
source gcr_env_vars.sh
env
git config --global url.https://${CI_USER_TOKEN}@github.com/.insteadOf git@github.com:

pushd vendor
git submodule update --init --recursive
popd

docker build -t gcr.io/project-compute/continuous-deploy/project-ui:$COMMIT_SHA -f /workspace/installer/docker/ui/Dockerfile .
docker build -t gcr.io/project-compute/continuous-deploy/project-auth:$COMMIT_SHA -f /workspace/installer/docker/auth/Dockerfile .
Run Code Online (Sandbox Code Playgroud)

Max*_*ian 2

这对我有用,作为第一个构建步骤:

- name: gcr.io/cloud-builders/git
  args: [fetch, --depth=100]
Run Code Online (Sandbox Code Playgroud)