Retrieving tags in Google Cloud Builder

In the new google container creator, I cannot get the git tags at build time. During the build process, the default cloning does not seem to trigger the git tags. I added a custom build process that calls git fetch --tags , but this leads to an 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 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 . 
+7
google-compute-engine google-container-registry
source share
2 answers

This worked for me as the first build step:

 - name: gcr.io/cloud-builders/git args: [fetch, --depth=100] 
+2
source share

To be clear, do you want all tags to be available in the Git repository, and not just to activate tag changes? In the latter case, the trigger tag must be available IIUC.

I'll talk about someone on the Container Builder team for a more detailed explanation, but this error tells me that they used gcloud to clone the Google Cloud Resource Repository Repository (GCSR), which sets up the Git credential assistant, named for example. They probably did this in a different container before using yours or on the host. Since gcloud and / or the gcloud credential assistant are not available in your container, you cannot authenticate GCSR correctly.

You can learn a little more about the credential assistant here .

0
source share

All Articles