From 777fcfc04e3c63b6e78c6b51ef6656134649f696 Mon Sep 17 00:00:00 2001 From: Xiang Dai <764524258@qq.com> Date: Tue, 20 Aug 2019 22:08:49 +0800 Subject: [PATCH] optimize image tag script (#911) * add quota for sed Signed-off-by: Xiang Dai <764524258@qq.com> * add comment for head Signed-off-by: Xiang Dai <764524258@qq.com> --- tools/image-tag | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/image-tag b/tools/image-tag index cfa0aae7..406b0740 100755 --- a/tools/image-tag +++ b/tools/image-tag @@ -5,7 +5,9 @@ set -o nounset set -o pipefail WIP=$(git diff --quiet || echo '-WIP') -BRANCH=$(git rev-parse --abbrev-ref HEAD | sed s#/#-#g) +BRANCH=$(git rev-parse --abbrev-ref HEAD | sed 's#/#-#g') +# When 7 chars are not enough to be unique, git automatically uses more. +# We are forcing to 7 here, as we are doing for grafana/grafana as well. SHA=$(git rev-parse --short=7 HEAD | head -c7) # If this is a tag, use it, otherwise branch-hash -- GitLab