From fcc9c84aa6dc3c6ee2156af87206ffb4dc92e861 Mon Sep 17 00:00:00 2001 From: lguohan Date: Mon, 10 Apr 2017 01:11:26 -0700 Subject: [PATCH] [build]: use branch name instead of latest tag for dev build (#490) --- functions.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/functions.sh b/functions.sh index 8b2cdb7c50..8ca3d54223 100644 --- a/functions.sh +++ b/functions.sh @@ -53,6 +53,7 @@ docker_try_rmi() { sonic_get_version() { local describe=$(git describe --tags) local latest_tag=$(git describe --tags --abbrev=0) + local branch_name=$(git rev-parse --abbrev-ref HEAD) if [ -n "$(git status --untracked-files=no -s --ignore-submodules)" ]; then local dirty="-dirty" fi @@ -61,6 +62,6 @@ sonic_get_version() { if [ "$describe" == "$latest_tag" ]; then echo "${latest_tag}${dirty}" else - echo "${latest_tag}.${BUILD_NUMBER}${dirty:--$(git rev-parse --short HEAD)}" + echo "${branch_name}.${BUILD_NUMBER}${dirty:--$(git rev-parse --short HEAD)}" fi }