Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support to add SONiC OS Version in device info #14601

Merged
merged 2 commits into from
Apr 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Makefile.work
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,7 @@ SONIC_BUILD_INSTRUCTION := $(MAKE) \
GZ_COMPRESS_PROGRAM=$(GZ_COMPRESS_PROGRAM) \
MIRROR_SNAPSHOT=$(MIRROR_SNAPSHOT) \
SONIC_VERSION_CONTROL_COMPONENTS=$(SONIC_VERSION_CONTROL_COMPONENTS) \
SONIC_OS_VERSION=$(SONIC_OS_VERSION) \
$(SONIC_OVERRIDE_BUILD_VARS)

.PHONY: sonic-slave-build sonic-slave-bash init reset
Expand Down
1 change: 1 addition & 0 deletions build_debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,7 @@ export release="$(if [ -f $FILESYSTEM_ROOT/etc/sonic/sonic_release ]; then cat $
export build_date="$(date -u)"
export build_number="${BUILD_NUMBER:-0}"
export built_by="$USER@$BUILD_HOSTNAME"
export sonic_os_version="${SONIC_OS_VERSION}"
j2 files/build_templates/sonic_version.yml.j2 | sudo tee $FILESYSTEM_ROOT/etc/sonic/sonic_version.yml

## Copy over clean-up script
Expand Down
1 change: 1 addition & 0 deletions files/build_templates/sonic_version.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ built_by: {{ built_by }}
{% if ENABLE_ASAN == "y" -%}
asan: 'yes'
{% endif -%}
sonic_os_version: {{ sonic_os_version }}
2 changes: 2 additions & 0 deletions platform/vs/sonic-version.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

sonic_version=$(SONIC_GET_VERSION)
sonic_asic_platform=$(CONFIGURED_PLATFORM)
sonic_os_version=$(SONIC_OS_VERSION)

export sonic_version
export sonic_asic_platform
export sonic_os_version

SONIC_VERSION = sonic_version.yml
$(SONIC_VERSION)_SRC_PATH = $(PLATFORM_PATH)/sonic-version
Expand Down
3 changes: 3 additions & 0 deletions rules/config
Original file line number Diff line number Diff line change
Expand Up @@ -294,3 +294,6 @@ SONIC_SLAVE_DOCKER_DRIVER ?= vfs
# GZ_COMPRESS_PROGRAM - select pigz (a parallel implementation of gzip) to reduce a build time
# and speed up a decompression of docker images on target system
GZ_COMPRESS_PROGRAM ?= gzip

# SONIC_OS_VERSION - sonic os version
SONIC_OS_VERSION ?= 11
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this 11 correspond to the Debian version? If so, wouldn't it be better to read from /etc/lsb_release.yml and parse the version field there, rather than having it hardcoded here?

1 change: 1 addition & 0 deletions slave.mk
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ export BLDENV
export BUILD_WORKDIR
export GZ_COMPRESS_PROGRAM
export MIRROR_SNAPSHOT
export SONIC_OS_VERSION

###############################################################################
## Utility rules
Expand Down