What would be the general guidance on versioning when building a docker image using Google Cloud Builder?
I am specifically interested in the situation when the build is triggered by a code commit. Should the image tag reflect the version (as recommended by Kubernetes API)? If it should, how to achieve that?
In your configuration, you can specify the image as (for example) gcr.io/$PROJECT_ID/my-image:${REVISION_ID}
, and it will have a tag corresponding to the revision of the commit that triggered the build.
For documentation on the substitution syntax, see https://cloud.google.com/container-builder/docs/api/build-requests#substitutions