Container Builder not tagging images correctly, $TAG_NAME not working

7/1/2018

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.

-- farah
google-cloud-platform
google-container-builder
google-kubernetes-engine

1 Answer

7/13/2018

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
-- Ayulin
Source: StackOverflow