Skip to content

Commit

Permalink
[build] When generating image version, handle case where current comm…
Browse files Browse the repository at this point in the history
…it has no reachable tags (#2506)

Signed-off-by: Joe LeVeque <jolevequ@microsoft.com>
  • Loading branch information
jleveque authored and lguohan committed Jan 31, 2019
1 parent 3f138e8 commit d426584
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ sonic_get_version() {
BUILD_NUMBER=${BUILD_NUMBER:-0}
## Check if we are on tagged commit
## Note: escape the version string by sed: / -> _
if [ "$describe" == "$latest_tag" ]; then
if [ -n "$latest_tag" ] && [ "$describe" == "$latest_tag" ]; then
echo "${latest_tag}${dirty}" | sed 's/\//_/g'
else
echo "${branch_name}.${BUILD_NUMBER}${dirty:--$(git rev-parse --short HEAD)}" | sed 's/\//_/g'
Expand Down

0 comments on commit d426584

Please sign in to comment.