Add new docker-sonic-mgmt makefile flag: LEGACY_SONIC_MGMT_DOCKER (#17070)

Why I did it
This is part of Python3 migration project. This PR will add a new makefile flag: LEGACY_SONIC_MGMT_DOCKER
Now by default: LEGACY_SONIC_MGMT_DOCKER = y will build sonic-mgmt-docker with Python2 and Python3
If LEGACY_SONIC_MGMT_DOCKER = n will will sonic-mgmt-docker with Python3 only

Work item tracking
Microsoft ADO (number only): 25254349

How I did it
Add makefile flag: LEGACY_SONIC_MGMT_DOCKER

How to verify it
By default will build sonic-mgmt-docker with Python2 and Python3. No change compared to before.
Set LEGACY_SONIC_MGMT_DOCKER=n will build sonic-mgmt-docker with Python3 only
This commit is contained in:
ShiyanWangMS 2023-11-03 09:04:01 +08:00 committed by GitHub
parent ed07dbad09
commit 7013b05899
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 0 deletions

View File

@ -147,6 +147,10 @@ ifeq ($(ENABLE_DOCKER_BASE_PULL),)
override ENABLE_DOCKER_BASE_PULL = n
endif
ifeq ($(LEGACY_SONIC_MGMT_DOCKER),)
override LEGACY_SONIC_MGMT_DOCKER = y
endif
ifneq ($(GZ_COMPRESS_PROGRAM), pigz)
override GZ_COMPRESS_PROGRAM = gzip
endif
@ -572,6 +576,7 @@ SONIC_BUILD_INSTRUCTION := $(MAKE) \
ONIE_IMAGE_PART_SIZE=$(ONIE_IMAGE_PART_SIZE) \
SONIC_OS_VERSION=$(SONIC_OS_VERSION) \
PIP_HTTP_TIMEOUT=$(PIP_HTTP_TIMEOUT) \
LEGACY_SONIC_MGMT_DOCKER=$(LEGACY_SONIC_MGMT_DOCKER) \
$(SONIC_OVERRIDE_BUILD_VARS)
.PHONY: sonic-slave-build sonic-slave-bash init reset

View File

@ -1,6 +1,8 @@
{% set prefix = DEFAULT_CONTAINER_REGISTRY %}
FROM {{ prefix }}ubuntu:20.04
{% set legacy = LEGACY_SONIC_MGMT_DOCKER %}
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y apt-transport-https \
@ -117,6 +119,7 @@ RUN python3 -m pip install aiohttp \
&& rm -f 1.2.tar.gz \
&& python3 -m pip install nnpy
{% if legacy == 'y' or legacy == '1' %}
RUN curl -fsSL https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py \
&& python2 get-pip.py \
&& rm -f get-pip.py
@ -185,6 +188,7 @@ RUN python2 -m pip install allure-pytest==2.8.22 \
textfsm==1.1.3 \
thrift==0.11.0 \
virtualenv
{% endif %}
# Install docker-ce-cli
RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - \

View File

@ -443,6 +443,7 @@ $(info "BUILD_MULTIASIC_KVM" : "$(BUILD_MULTIASIC_KVM)")
endif
$(info "CROSS_BUILD_ENVIRON" : "$(CROSS_BUILD_ENVIRON)")
$(info "GZ_COMPRESS_PROGRAM" : "$(GZ_COMPRESS_PROGRAM)")
$(info "LEGACY_SONIC_MGMT_DOCKER" : "$(LEGACY_SONIC_MGMT_DOCKER)")
$(info )
else
$(info SONiC Build System for $(CONFIGURED_PLATFORM):$(CONFIGURED_ARCH))