[build] When generating image version, handle case where current commit has no reachable tags (#2506)
Signed-off-by: Joe LeVeque <jolevequ@microsoft.com>
This commit is contained in:
parent
3f138e899c
commit
d426584748
@ -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'
|
||||
|
Loading…
Reference in New Issue
Block a user