diff --git a/.azure-pipelines/official-build.yml b/.azure-pipelines/official-build.yml index fa79be96974..84c2be26dd3 100644 --- a/.azure-pipelines/official-build.yml +++ b/.azure-pipelines/official-build.yml @@ -20,6 +20,7 @@ stages: pool: sonicbld variables: CACHE_MODE: wcache + BRANCH_NAME: $(Build.SourceBranchName) ${{ if eq(variables['Build.SourceBranchName'], '202012') }}: VERSION_CONTROL_OPTIONS: 'SONIC_VERSION_CONTROL_COMPONENTS=deb,py2,py3,web' jobs: diff --git a/functions.sh b/functions.sh index 6015704d58d..f7630a950c3 100644 --- a/functions.sh +++ b/functions.sh @@ -54,6 +54,7 @@ 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) + [ -n "$BRANCH_NAME" ] && branch_name=$BRANCH_NAME if [ -n "$(git status --untracked-files=no -s --ignore-submodules)" ]; then local dirty="-dirty-$BUILD_TIMESTAMP" fi