Search code examples
google-cloud-platformgoogle-kubernetes-enginegoogle-container-builder

Container Builder not tagging images correctly, $TAG_NAME not working


I am tagging my images locally with:

git describe --tags --always --dirty

and get a short seven character hash I can tag my images with.

However in Google Container Builder, when I set the image name to

gcr.io/$PROJECT_ID/amal-img:$COMMIT_SHA

enter image description here

I get a really long tag gcr.io/$PROJECT_ID/amal-img/amal-img:00528e0498ebb746d047de3bb38e483b69f72d89

When I try to use one of the available variables, $TAG_NAME instead, i.e gcr.io/$PROJECT_ID/amal-img/amal-img:$TAG_NAME

I get the error message Failed to trigger build: Request contains an invalid argument.


Solution

  • It's not listed in the "Supported variables" field text in your screenshot, but you might be able to use $SHORT_SHA instead - it's given as a supported substitution in the docs:

    $SHORT_SHA : The first seven characters of COMMIT_SHA