Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fetching Tags in Google Cloud Builder

In the newly created google container builder I am unable to fetch git tags during a build. During the build process the default cloning does not seem to fetch git tags. I added a custom build process which calls git fetch --tags but this results in the error:

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 [email protected]:

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 .
like image 521
quasiben Avatar asked Mar 29 '17 13:03

quasiben


People also ask

What are tags in Google cloud?

Tags are comprised of a key-value pair, and are attached to an organization, folder, or project resource in your Google Cloud hierarchy. To create a new tag, you must first create a tag key that describes the tag you are creating.


1 Answers

This worked for me, as the first build step:

- name: gcr.io/cloud-builders/git
  args: [fetch, --depth=100]
like image 81
Maximilian Avatar answered Oct 06 '22 01:10

Maximilian