From 7c5f616469d24ee20916e0cb526ca5ecb55cc3f9 Mon Sep 17 00:00:00 2001 From: Saikrishna Arcot Date: Tue, 28 Nov 2023 16:41:13 -0800 Subject: [PATCH] Fix sonic-mgmt docker build due to Bookworm changes (#17309) * Fix sonic-mgmt docker build due to Bookworm changes Because of the Bookworm upgrade, when some build target is specified on the command line, the build system will try to build everything for buster and bullseye distros, even if it's not needed by the target. As a workaround, call the underlying Makefile.work script with `BLDENV=bullseye` to have it only build packages related to sonic-mgmt. Signed-off-by: Saikrishna Arcot * Mark docker-sonic-mgmt as a Bullseye container Signed-off-by: Saikrishna Arcot --------- Signed-off-by: Saikrishna Arcot --- .azure-pipelines/docker-sonic-mgmt-py3-only.yml | 2 +- .azure-pipelines/docker-sonic-mgmt.yml | 2 +- rules/docker-sonic-mgmt.mk | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/docker-sonic-mgmt-py3-only.yml b/.azure-pipelines/docker-sonic-mgmt-py3-only.yml index d79706bc10..f31e069bbc 100644 --- a/.azure-pipelines/docker-sonic-mgmt-py3-only.yml +++ b/.azure-pipelines/docker-sonic-mgmt-py3-only.yml @@ -43,7 +43,7 @@ stages: git submodule update --init --recursive -- src/sonic-platform-daemons src/sonic-genl-packet src/sonic-sairedis src/ptf src/sonic-device-data make SONIC_BUILD_JOBS=$(nproc) DEFAULT_CONTAINER_REGISTRY=publicmirror.azurecr.io ENABLE_DOCKER_BASE_PULL=y configure PLATFORM=generic - make SONIC_BUILD_JOBS=$(nproc) DEFAULT_CONTAINER_REGISTRY=publicmirror.azurecr.io ENABLE_DOCKER_BASE_PULL=y LEGACY_SONIC_MGMT_DOCKER=n target/docker-sonic-mgmt.gz + make -f Makefile.work BLDENV=bullseye SONIC_BUILD_JOBS=$(nproc) DEFAULT_CONTAINER_REGISTRY=publicmirror.azurecr.io ENABLE_DOCKER_BASE_PULL=y LEGACY_SONIC_MGMT_DOCKER=n target/docker-sonic-mgmt.gz cp target -r $(Build.ArtifactStagingDirectory)/target docker load -i target/docker-sonic-mgmt.gz docker tag docker-sonic-mgmt $REGISTRY_SERVER/docker-sonic-mgmt:py3only diff --git a/.azure-pipelines/docker-sonic-mgmt.yml b/.azure-pipelines/docker-sonic-mgmt.yml index 27bf970dab..207d8ee710 100644 --- a/.azure-pipelines/docker-sonic-mgmt.yml +++ b/.azure-pipelines/docker-sonic-mgmt.yml @@ -43,7 +43,7 @@ stages: git submodule update --init --recursive -- src/sonic-platform-daemons src/sonic-genl-packet src/sonic-sairedis src/ptf src/sonic-device-data make SONIC_BUILD_JOBS=$(nproc) DEFAULT_CONTAINER_REGISTRY=publicmirror.azurecr.io ENABLE_DOCKER_BASE_PULL=y configure PLATFORM=generic - make SONIC_BUILD_JOBS=$(nproc) DEFAULT_CONTAINER_REGISTRY=publicmirror.azurecr.io ENABLE_DOCKER_BASE_PULL=y LEGACY_SONIC_MGMT_DOCKER=y target/docker-sonic-mgmt.gz + make -f Makefile.work BLDENV=bullseye SONIC_BUILD_JOBS=$(nproc) DEFAULT_CONTAINER_REGISTRY=publicmirror.azurecr.io ENABLE_DOCKER_BASE_PULL=y LEGACY_SONIC_MGMT_DOCKER=y target/docker-sonic-mgmt.gz cp target -r $(Build.ArtifactStagingDirectory)/target docker load -i target/docker-sonic-mgmt.gz docker tag docker-sonic-mgmt $REGISTRY_SERVER/docker-sonic-mgmt:latest diff --git a/rules/docker-sonic-mgmt.mk b/rules/docker-sonic-mgmt.mk index b1aaad3487..7896fd66ae 100644 --- a/rules/docker-sonic-mgmt.mk +++ b/rules/docker-sonic-mgmt.mk @@ -3,3 +3,4 @@ DOCKER_SONIC_MGMT = docker-sonic-mgmt.gz $(DOCKER_SONIC_MGMT)_PATH = $(DOCKERS_PATH)/docker-sonic-mgmt $(DOCKER_SONIC_MGMT)_DEPENDS += $(SONIC_DEVICE_DATA) $(PTF) SONIC_DOCKER_IMAGES += $(DOCKER_SONIC_MGMT) +SONIC_BULLSEYE_DOCKERS += $(DOCKER_SONIC_MGMT)