[build]: add branch and release name in sonic_version.yml
the branch refers the branch name that the commit is in, for example master, 202012, 201911, ... In case there is no branch, the name will be HEAD. release is encoded in /etc/sonic/sonic_release file. the file is only available for a release branch. It is not available in master branch. Signed-off-by: Guohan Lu <lguohan@gmail.com>
This commit is contained in:
parent
25f53289eb
commit
e38cc58bbc
@ -471,12 +471,17 @@ fi
|
||||
|
||||
## Version file
|
||||
sudo mkdir -p $FILESYSTEM_ROOT/etc/sonic
|
||||
if [ -f files/image_config/sonic_release ]; then
|
||||
sudo cp files/image_config/sonic_release $FILESYSTEM_ROOT/etc/sonic/
|
||||
fi
|
||||
sudo tee $FILESYSTEM_ROOT/etc/sonic/sonic_version.yml > /dev/null <<EOF
|
||||
build_version: '${SONIC_IMAGE_VERSION}'
|
||||
debian_version: '$(cat $FILESYSTEM_ROOT/etc/debian_version)'
|
||||
kernel_version: '$kversion'
|
||||
asic_type: $sonic_asic_platform
|
||||
commit_id: '$(git rev-parse --short HEAD)'
|
||||
branch: '$(git rev-parse --abbrev-ref HEAD)'
|
||||
release: '$(if [ -f $FILESYSTEM_ROOT/etc/sonic/sonic_release ]; then cat $FILESYSTEM_ROOT/etc/sonic/sonic_release; else echo none; fi)'
|
||||
build_date: $(date -u)
|
||||
build_number: ${BUILD_NUMBER:-0}
|
||||
built_by: $USER@$BUILD_HOSTNAME
|
||||
|
@ -2,6 +2,7 @@ tee $1 > /dev/null <<EOF
|
||||
build_version: '$sonic_version'
|
||||
asic_type: $sonic_asic_platform
|
||||
commit_id: '$(git rev-parse --short HEAD)'
|
||||
branch: '$(git rev-parse --abbrev-ref HEAD)'
|
||||
build_date: $(date -u)
|
||||
build_number: ${BUILD_NUMBER:-0}
|
||||
built_by: $USER@$BUILD_HOSTNAME
|
||||
|
Loading…
Reference in New Issue
Block a user