Skip to content

Commit

Permalink
Append dirty if contains local changes
Browse files Browse the repository at this point in the history
Signed-off-by: marian-pritsak <marianp@mellanox.com>
  • Loading branch information
marian-pritsak committed Apr 4, 2017
1 parent bc2e3a4 commit 1fd773f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ DOCKER_BUILD = docker build --no-cache \
-f slave.mk \
PLATFORM=$(PLATFORM) \
BUILD_NUMBER=$(BUILD_NUMBER) \
ENABLE_DHCP_GRAPH_SERVICE=$(ENABLE_DHCP_GRAPH_SERVICE) \
$@

sonic-slave-build :
Expand Down
11 changes: 7 additions & 4 deletions functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,14 @@ docker_try_rmi() {
sonic_get_version() {
local describe=$(git describe --tags)
local latest_tag=$(git describe --tags --abbrev=0)
BUILD_NUMBER=${BUILD_NUMBER:-dev}
## Cehck if we are on tagged commit
if [ -n "$(git status --untracked-files=no -s --ignore-submodules)" ]; then
local dirty="-dirty"
fi
BUILD_NUMBER=${BUILD_NUMBER:-0}
## Check if we are on tagged commit
if [ "$describe" == "$latest_tag" ]; then
echo "$latest_tag"
echo "${latest_tag}${dirty}"
else
echo "${latest_tag}.${BUILD_NUMBER}-$(git rev-parse --short HEAD)"
echo "${latest_tag}.${BUILD_NUMBER}${dirty:--$(git rev-parse --short HEAD)}"
fi
}

0 comments on commit 1fd773f

Please sign in to comment.