From a624e0c0b205b84dc70c72dbf511446bcf8723e6 Mon Sep 17 00:00:00 2001 From: Stepan Blyschak Date: Mon, 14 Sep 2020 14:50:04 +0300 Subject: [PATCH 01/44] [dockers] Tag all docker images with a version number Previously all docker images built into SONiC binary were tagged with SONiC version string. With the introduction of container upgrades and SONiC extension framework all docker images should have their own version numbers that do not relate with SONiC version. All dockers are tagged with version 1.0.0 in this PR. Whenever changes are introduced to a docker image that require a version change, the docker image maintainer should update the version number. Signed-off-by: Stepan Blyschak --- files/build_templates/sonic_debian_extension.j2 | 10 ++++++---- platform/barefoot/docker-syncd-bfn-rpc.mk | 1 + platform/barefoot/docker-syncd-bfn.mk | 2 ++ platform/broadcom/docker-syncd-brcm-rpc.mk | 1 + platform/broadcom/docker-syncd-brcm.mk | 2 ++ platform/cavium/docker-syncd-cavm-rpc.mk | 1 + platform/cavium/docker-syncd-cavm.mk | 2 ++ platform/centec-arm64/docker-syncd-centec-rpc.mk | 1 + platform/centec-arm64/docker-syncd-centec.mk | 1 + platform/centec/docker-syncd-centec-rpc.mk | 1 + platform/centec/docker-syncd-centec.mk | 2 ++ platform/innovium/docker-syncd-invm-rpc.mk | 1 + platform/innovium/docker-syncd-invm.mk | 2 ++ platform/marvell-arm64/docker-syncd-mrvl-rpc.mk | 1 + platform/marvell-arm64/docker-syncd-mrvl.mk | 2 ++ platform/marvell-armhf/docker-syncd-mrvl-rpc.mk | 1 + platform/marvell-armhf/docker-syncd-mrvl.mk | 2 ++ platform/marvell/docker-syncd-mrvl-rpc.mk | 1 + platform/marvell/docker-syncd-mrvl.mk | 2 ++ platform/mellanox/docker-syncd-mlnx-rpc.mk | 1 + platform/mellanox/docker-syncd-mlnx.mk | 2 ++ platform/nephos/docker-syncd-nephos-rpc.mk | 1 + platform/nephos/docker-syncd-nephos.mk | 4 +++- platform/vs/docker-gbsyncd-vs.mk | 1 + platform/vs/docker-syncd-vs.mk | 2 ++ rules/docker-database.mk | 2 ++ rules/docker-dhcp-relay.mk | 2 ++ rules/docker-fpm-frr.mk | 2 ++ rules/docker-fpm-gobgp.mk | 3 +++ rules/docker-fpm-quagga.mk | 3 +++ rules/docker-iccpd.mk | 2 ++ rules/docker-lldp.mk | 2 ++ rules/docker-nat.mk | 2 ++ rules/docker-orchagent.mk | 2 ++ rules/docker-platform-monitor.mk | 2 ++ rules/docker-restapi.mk | 2 ++ rules/docker-router-advertiser.mk | 2 ++ rules/docker-sflow.mk | 2 ++ rules/docker-snmp.mk | 2 ++ rules/docker-sonic-mgmt-framework.mk | 3 +++ rules/docker-teamd.mk | 2 ++ rules/docker-telemetry.mk | 3 +++ slave.mk | 2 +- 43 files changed, 81 insertions(+), 6 deletions(-) diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 7afc099e3a40..d9d0d54ed518 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -513,13 +513,15 @@ sudo mkdir $FILESYSTEM_ROOT/target sudo mount --bind target $FILESYSTEM_ROOT/target sudo chroot $FILESYSTEM_ROOT docker $SONIC_NATIVE_DOCKERD_FOR_DOCKERFS info {% for image in installer_images.strip().split(' ') -%} -{% set imagefilename = image.split('/')|last -%} +{% set imagefilepath = image.split(':')|first -%} +{% set imageversion = image.split(':')|last -%} +{% set imagefilename = imagefilepath.split('/')|last -%} {% set imagename = imagefilename.split('.')|first -%} -sudo LANG=C chroot $FILESYSTEM_ROOT docker $SONIC_NATIVE_DOCKERD_FOR_DOCKERFS load -i {{image}} -sudo LANG=C chroot $FILESYSTEM_ROOT docker $SONIC_NATIVE_DOCKERD_FOR_DOCKERFS tag {{imagename}}:latest {{imagename}}:"${SONIC_IMAGE_VERSION}" +sudo LANG=C chroot $FILESYSTEM_ROOT docker $SONIC_NATIVE_DOCKERD_FOR_DOCKERFS load -i {{imagefilepath}} +sudo LANG=C chroot $FILESYSTEM_ROOT docker $SONIC_NATIVE_DOCKERD_FOR_DOCKERFS tag {{imagename}}:latest {{imagename}}:{{imageversion}} {% if imagename.endswith('-dbg') %} {% set imagebasename = imagename.replace('-dbg', '') -%} -sudo LANG=C chroot $FILESYSTEM_ROOT docker $SONIC_NATIVE_DOCKERD_FOR_DOCKERFS tag {{imagename}}:latest {{imagebasename}}:"${SONIC_IMAGE_VERSION}" +sudo LANG=C chroot $FILESYSTEM_ROOT docker $SONIC_NATIVE_DOCKERD_FOR_DOCKERFS tag {{imagename}}:latest {{imagebasename}}:{{imageversion}} sudo LANG=C chroot $FILESYSTEM_ROOT docker $SONIC_NATIVE_DOCKERD_FOR_DOCKERFS tag {{imagename}}:latest {{imagebasename}}:latest {% endif %} {% endfor %} diff --git a/platform/barefoot/docker-syncd-bfn-rpc.mk b/platform/barefoot/docker-syncd-bfn-rpc.mk index 11b70a3a774f..41c55b1bcf7d 100644 --- a/platform/barefoot/docker-syncd-bfn-rpc.mk +++ b/platform/barefoot/docker-syncd-bfn-rpc.mk @@ -18,6 +18,7 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_BFN_RPC) endif $(DOCKER_SYNCD_BFN_RPC)_CONTAINER_NAME = syncd +$(DOCKER_SYNCD_BFN_RPC)_VERSION = 1.0.0 $(DOCKER_SYNCD_BFN_RPC)_RUN_OPT += --net=host --privileged -t $(DOCKER_SYNCD_BFN_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf $(DOCKER_SYNCD_BFN_RPC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro diff --git a/platform/barefoot/docker-syncd-bfn.mk b/platform/barefoot/docker-syncd-bfn.mk index ae4ca9d9f272..d3d018393b47 100644 --- a/platform/barefoot/docker-syncd-bfn.mk +++ b/platform/barefoot/docker-syncd-bfn.mk @@ -10,6 +10,8 @@ $(DOCKER_SYNCD_BASE)_DBG_DEPENDS += $(SYNCD_DBG) \ $(LIBSAIMETADATA_DBG) \ $(LIBSAIREDIS_DBG) +$(DOCKER_SYNCD_BASE)_VERSION = 1.0.0 + SONIC_STRETCH_DOCKERS += $(DOCKER_SYNCD_BASE) SONIC_STRETCH_DBG_DOCKERS += $(DOCKER_SYNCD_BASE_DBG) diff --git a/platform/broadcom/docker-syncd-brcm-rpc.mk b/platform/broadcom/docker-syncd-brcm-rpc.mk index b1a58232927d..ca9bfaac54dd 100644 --- a/platform/broadcom/docker-syncd-brcm-rpc.mk +++ b/platform/broadcom/docker-syncd-brcm-rpc.mk @@ -18,6 +18,7 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_BRCM_RPC) endif $(DOCKER_SYNCD_BRCM_RPC)_CONTAINER_NAME = syncd +$(DOCKER_SYNCD_BRCM_RPC)_VERSION = 1.0.0 $(DOCKER_SYNCD_BRCM_RPC)_RUN_OPT += --privileged -t $(DOCKER_SYNCD_BRCM_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf $(DOCKER_SYNCD_BRCM_RPC)_RUN_OPT += -v /host/warmboot:/var/warmboot diff --git a/platform/broadcom/docker-syncd-brcm.mk b/platform/broadcom/docker-syncd-brcm.mk index b1b412fc9edd..3b59a99f9131 100644 --- a/platform/broadcom/docker-syncd-brcm.mk +++ b/platform/broadcom/docker-syncd-brcm.mk @@ -14,6 +14,8 @@ $(DOCKER_SYNCD_BASE)_DBG_DEPENDS += $(SYNCD_DBG) \ SONIC_STRETCH_DOCKERS += $(DOCKER_SYNCD_BASE) SONIC_STRETCH_DBG_DOCKERS += $(DOCKER_SYNCD_BASE_DBG) +$(DOCKER_SYNCD_BASE)_VERSION = 1.0.0 + $(DOCKER_SYNCD_BASE)_RUN_OPT += -v /host/warmboot:/var/warmboot $(DOCKER_SYNCD_BASE)_BASE_IMAGE_FILES += bcmcmd:/usr/bin/bcmcmd diff --git a/platform/cavium/docker-syncd-cavm-rpc.mk b/platform/cavium/docker-syncd-cavm-rpc.mk index a19124609bb0..10a47d31b32b 100644 --- a/platform/cavium/docker-syncd-cavm-rpc.mk +++ b/platform/cavium/docker-syncd-cavm-rpc.mk @@ -17,6 +17,7 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_CAVM_RPC) endif $(DOCKER_SYNCD_CAVM_RPC)_CONTAINER_NAME = syncd +$(DOCKER_SYNCD_CAVM_RPC)_VERSION = 1.0.0 $(DOCKER_SYNCD_CAVM_RPC)_RUN_OPT += --net=host --privileged -t $(DOCKER_SYNCD_CAVM_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf $(DOCKER_SYNCD_CAVM_RPC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro diff --git a/platform/cavium/docker-syncd-cavm.mk b/platform/cavium/docker-syncd-cavm.mk index 059d2c71ebb4..02b1a6d73f83 100644 --- a/platform/cavium/docker-syncd-cavm.mk +++ b/platform/cavium/docker-syncd-cavm.mk @@ -16,6 +16,8 @@ ifneq ($(ENABLE_SYNCD_RPC),y) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_CAVM) endif +$(DOCKER_SYNCD_BASE)_VERSION = 1.0.0 + $(DOCKER_SYNCD_CAVM)_CONTAINER_NAME = syncd $(DOCKER_SYNCD_CAVM)_RUN_OPT += --net=host --privileged -t $(DOCKER_SYNCD_CAVM)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf diff --git a/platform/centec-arm64/docker-syncd-centec-rpc.mk b/platform/centec-arm64/docker-syncd-centec-rpc.mk index 8d699c91347f..e66089249622 100755 --- a/platform/centec-arm64/docker-syncd-centec-rpc.mk +++ b/platform/centec-arm64/docker-syncd-centec-rpc.mk @@ -18,6 +18,7 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_CENTEC_RPC) endif $(DOCKER_SYNCD_CENTEC_RPC)_CONTAINER_NAME = syncd +$(DOCKER_SYNCD_CENTEC_RPC)_VERSION = 1.0.0 $(DOCKER_SYNCD_CENTEC_RPC)_RUN_OPT += --privileged -t $(DOCKER_SYNCD_CENTEC_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf $(DOCKER_SYNCD_CENTEC_RPC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro diff --git a/platform/centec-arm64/docker-syncd-centec.mk b/platform/centec-arm64/docker-syncd-centec.mk index 9943420660a4..e9db642b026e 100755 --- a/platform/centec-arm64/docker-syncd-centec.mk +++ b/platform/centec-arm64/docker-syncd-centec.mk @@ -13,6 +13,7 @@ $(DOCKER_SYNCD_BASE)_DBG_DEPENDS += $(SYNCD_DBG) \ SONIC_STRETCH_DOCKERS += $(DOCKER_SYNCD_BASE) SONIC_STRETCH_DBG_DOCKERS += $(DOCKER_SYNCD_BASE_DBG) +$(DOCKER_SYNCD_BASE)_VERSION = 1.0.0 $(DOCKER_SYNCD_BASE)_RUN_OPT += -v /host/warmboot:/var/warmboot $(DOCKER_SYNCD_CENTEC)_RUN_OPT += --privileged -t $(DOCKER_SYNCD_CENTEC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf diff --git a/platform/centec/docker-syncd-centec-rpc.mk b/platform/centec/docker-syncd-centec-rpc.mk index 8915f1c35679..b5b98e7bee4e 100644 --- a/platform/centec/docker-syncd-centec-rpc.mk +++ b/platform/centec/docker-syncd-centec-rpc.mk @@ -18,6 +18,7 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_CENTEC_RPC) endif $(DOCKER_SYNCD_CENTEC_RPC)_CONTAINER_NAME = syncd +$(DOCKER_SYNCD_CENTEC_RPC)_VERSION = 1.0.0 $(DOCKER_SYNCD_CENTEC_RPC)_RUN_OPT += --privileged -t $(DOCKER_SYNCD_CENTEC_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf $(DOCKER_SYNCD_CENTEC_RPC)_RUN_OPT += -v /var/run/docker-syncd:/var/run/sswsyncd diff --git a/platform/centec/docker-syncd-centec.mk b/platform/centec/docker-syncd-centec.mk index ada63a218d4a..d5d819f2235a 100644 --- a/platform/centec/docker-syncd-centec.mk +++ b/platform/centec/docker-syncd-centec.mk @@ -13,6 +13,8 @@ $(DOCKER_SYNCD_CENTEC)_DEPENDS += $(SYNCD_DBG) \ SONIC_STRETCH_DOCKERS += $(DOCKER_SYNCD_BASE) SONIC_STRETCH_DBG_DOCKERS += $(DOCKER_SYNCD_BASE_DBG) +$(DOCKER_SYNCD_BASE)_VERSION = 1.0.0 + $(DOCKER_SYNCD_CENTEC)_RUN_OPT += --privileged -t $(DOCKER_SYNCD_CENTEC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf $(DOCKER_SYNCD_CENTEC)_RUN_OPT += -v /var/run/docker-syncd:/var/run/sswsyncd diff --git a/platform/innovium/docker-syncd-invm-rpc.mk b/platform/innovium/docker-syncd-invm-rpc.mk index 62d6891bbc21..de4cce280c70 100755 --- a/platform/innovium/docker-syncd-invm-rpc.mk +++ b/platform/innovium/docker-syncd-invm-rpc.mk @@ -10,6 +10,7 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_INVM_RPC) endif $(DOCKER_SYNCD_INVM_RPC)_CONTAINER_NAME = syncd +$(DOCKER_SYNCD_INVM_RPC)_VERSION = 1.0.0 $(DOCKER_SYNCD_INVM_RPC)_RUN_OPT += --net=host --privileged -t $(DOCKER_SYNCD_INVM_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf $(DOCKER_SYNCD_INVM_RPC)_RUN_OPT += -v /var/run/docker-syncd:/var/run/sswsyncd diff --git a/platform/innovium/docker-syncd-invm.mk b/platform/innovium/docker-syncd-invm.mk index 52c11b90911d..75d0a1d4933b 100755 --- a/platform/innovium/docker-syncd-invm.mk +++ b/platform/innovium/docker-syncd-invm.mk @@ -13,4 +13,6 @@ $(DOCKER_SYNCD_BASE)_DBG_DEPENDS += $(SYNCD_DBG) \ SONIC_STRETCH_DOCKERS += $(DOCKER_SYNCD_BASE) SONIC_STRETCH_DBG_DOCKERS += $(DOCKER_SYNCD_BASE_DBG) +$(DOCKER_SYNCD_BASE)_VERSION = 1.0.0 + $(DOCKER_SYNCD_BASE)_RUN_OPT += -v /host/warmboot:/var/warmboot diff --git a/platform/marvell-arm64/docker-syncd-mrvl-rpc.mk b/platform/marvell-arm64/docker-syncd-mrvl-rpc.mk index c3ce6c10119c..4d5b445cfbf7 100644 --- a/platform/marvell-arm64/docker-syncd-mrvl-rpc.mk +++ b/platform/marvell-arm64/docker-syncd-mrvl-rpc.mk @@ -18,6 +18,7 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_MRVL_RPC) endif $(DOCKER_SYNCD_MRVL_RPC)_CONTAINER_NAME = syncd +$(DOCKER_SYNCD_MRVL_RPC)_VERSION = 1.0.0 $(DOCKER_SYNCD_MRVL_RPC)_RUN_OPT += --net=host --privileged -t $(DOCKER_SYNCD_MRVL_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf $(DOCKER_SYNCD_MRVL_RPC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro diff --git a/platform/marvell-arm64/docker-syncd-mrvl.mk b/platform/marvell-arm64/docker-syncd-mrvl.mk index dd01caab687b..2b8fc7f9d2ca 100644 --- a/platform/marvell-arm64/docker-syncd-mrvl.mk +++ b/platform/marvell-arm64/docker-syncd-mrvl.mk @@ -13,5 +13,7 @@ $(DOCKER_SYNCD_BASE)_DBG_DEPENDS += $(SYNCD_DBG) \ SONIC_STRETCH_DOCKERS += $(DOCKER_SYNCD_BASE) SONIC_STRETCH_DBG_DOCKERS += $(DOCKER_SYNCD_BASE_DBG) +$(DOCKER_SYNCD_BASE)_VERSION = 1.0.0 + $(DOCKER_SYNCD_BASE)_RUN_OPT += -v /host/warmboot:/var/warmboot $(DOCKER_SYNCD_BASE)_BASE_IMAGE_FILES += monit_syncd:/etc/monit/conf.d diff --git a/platform/marvell-armhf/docker-syncd-mrvl-rpc.mk b/platform/marvell-armhf/docker-syncd-mrvl-rpc.mk index c3ce6c10119c..4d5b445cfbf7 100644 --- a/platform/marvell-armhf/docker-syncd-mrvl-rpc.mk +++ b/platform/marvell-armhf/docker-syncd-mrvl-rpc.mk @@ -18,6 +18,7 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_MRVL_RPC) endif $(DOCKER_SYNCD_MRVL_RPC)_CONTAINER_NAME = syncd +$(DOCKER_SYNCD_MRVL_RPC)_VERSION = 1.0.0 $(DOCKER_SYNCD_MRVL_RPC)_RUN_OPT += --net=host --privileged -t $(DOCKER_SYNCD_MRVL_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf $(DOCKER_SYNCD_MRVL_RPC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro diff --git a/platform/marvell-armhf/docker-syncd-mrvl.mk b/platform/marvell-armhf/docker-syncd-mrvl.mk index dd01caab687b..2b8fc7f9d2ca 100644 --- a/platform/marvell-armhf/docker-syncd-mrvl.mk +++ b/platform/marvell-armhf/docker-syncd-mrvl.mk @@ -13,5 +13,7 @@ $(DOCKER_SYNCD_BASE)_DBG_DEPENDS += $(SYNCD_DBG) \ SONIC_STRETCH_DOCKERS += $(DOCKER_SYNCD_BASE) SONIC_STRETCH_DBG_DOCKERS += $(DOCKER_SYNCD_BASE_DBG) +$(DOCKER_SYNCD_BASE)_VERSION = 1.0.0 + $(DOCKER_SYNCD_BASE)_RUN_OPT += -v /host/warmboot:/var/warmboot $(DOCKER_SYNCD_BASE)_BASE_IMAGE_FILES += monit_syncd:/etc/monit/conf.d diff --git a/platform/marvell/docker-syncd-mrvl-rpc.mk b/platform/marvell/docker-syncd-mrvl-rpc.mk index c3ce6c10119c..4d5b445cfbf7 100644 --- a/platform/marvell/docker-syncd-mrvl-rpc.mk +++ b/platform/marvell/docker-syncd-mrvl-rpc.mk @@ -18,6 +18,7 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_MRVL_RPC) endif $(DOCKER_SYNCD_MRVL_RPC)_CONTAINER_NAME = syncd +$(DOCKER_SYNCD_MRVL_RPC)_VERSION = 1.0.0 $(DOCKER_SYNCD_MRVL_RPC)_RUN_OPT += --net=host --privileged -t $(DOCKER_SYNCD_MRVL_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf $(DOCKER_SYNCD_MRVL_RPC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro diff --git a/platform/marvell/docker-syncd-mrvl.mk b/platform/marvell/docker-syncd-mrvl.mk index d6d7d032b8ac..4cac777bf9e5 100644 --- a/platform/marvell/docker-syncd-mrvl.mk +++ b/platform/marvell/docker-syncd-mrvl.mk @@ -13,6 +13,8 @@ $(DOCKER_SYNCD_BASE)_DBG_DEPENDS += $(SYNCD_DBG) \ SONIC_STRETCH_DOCKERS += $(DOCKER_SYNCD_BASE) SONIC_STRETCH_DBG_DOCKERS += $(DOCKER_SYNCD_BASE_DBG) +$(DOCKER_SYNCD_BASE)_VERSION = 1.0.0 + $(DOCKER_SYNCD_BASE)_RUN_OPT += -v /host/warmboot:/var/warmboot $(DOCKER_SYNCD_BASE)_RUN_OPT += -v /var/run/docker-syncd:/var/run/sswsyncd $(DOCKER_SYNCD_BASE)_BASE_IMAGE_FILES += monit_syncd:/etc/monit/conf.d diff --git a/platform/mellanox/docker-syncd-mlnx-rpc.mk b/platform/mellanox/docker-syncd-mlnx-rpc.mk index 806b40035f23..dcdc79d36b59 100644 --- a/platform/mellanox/docker-syncd-mlnx-rpc.mk +++ b/platform/mellanox/docker-syncd-mlnx-rpc.mk @@ -20,6 +20,7 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_MLNX_RPC) endif $(DOCKER_SYNCD_MLNX_RPC)_CONTAINER_NAME = syncd +$(DOCKER_SYNCD_MLNX_RPC)_VERSION = 1.0.0 $(DOCKER_SYNCD_MLNX_RPC)_RUN_OPT += --privileged -t $(DOCKER_SYNCD_MLNX_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf $(DOCKER_SYNCD_MLNX_RPC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro diff --git a/platform/mellanox/docker-syncd-mlnx.mk b/platform/mellanox/docker-syncd-mlnx.mk index 9bdc5a8ad8ec..c98cbebc01f2 100644 --- a/platform/mellanox/docker-syncd-mlnx.mk +++ b/platform/mellanox/docker-syncd-mlnx.mk @@ -14,5 +14,7 @@ ifeq ($(SDK_FROM_SRC), y) $(DOCKER_SYNCD_BASE)_DBG_DEPENDS += $(MLNX_SDK_DBG_DEBS) $(MLNX_SAI_DBGSYM) endif +$(DOCKER_SYNCD_BASE)_VERSION = 1.0.0 + $(DOCKER_SYNCD_BASE)_RUN_OPT += -v /host/warmboot:/var/warmboot $(DOCKER_SYNCD_BASE)_BASE_IMAGE_FILES += monit_syncd:/etc/monit/conf.d diff --git a/platform/nephos/docker-syncd-nephos-rpc.mk b/platform/nephos/docker-syncd-nephos-rpc.mk index 39240c1913e4..8d3eeb55b01c 100644 --- a/platform/nephos/docker-syncd-nephos-rpc.mk +++ b/platform/nephos/docker-syncd-nephos-rpc.mk @@ -18,6 +18,7 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_NEPHOS_RPC) endif $(DOCKER_SYNCD_NEPHOS_RPC)_CONTAINER_NAME = syncd +$(DOCKER_SYNCD_NEPHOS_RPC)_VERSION = 1.0.0 $(DOCKER_SYNCD_NEPHOS_RPC)_RUN_OPT += --net=host --privileged -t $(DOCKER_SYNCD_NEPHOS_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf $(DOCKER_SYNCD_NEPHOS_RPC)_RUN_OPT += -v /host/warmboot:/var/warmboot diff --git a/platform/nephos/docker-syncd-nephos.mk b/platform/nephos/docker-syncd-nephos.mk index 146523ec1c64..f61320cdfaca 100644 --- a/platform/nephos/docker-syncd-nephos.mk +++ b/platform/nephos/docker-syncd-nephos.mk @@ -10,10 +10,12 @@ $(DOCKER_SYNCD_BASE)_DBG_DEPENDS += $(SYNCD_DBG) \ $(LIBSWSSCOMMON_DBG) \ $(LIBSAIMETADATA_DBG) \ $(LIBSAIREDIS_DBG) - + SONIC_STRETCH_DOCKERS += $(DOCKER_SYNCD_BASE) SONIC_STRETCH_DBG_DOCKERS += $(DOCKER_SYNCD_BASE_DBG) +$(DOCKER_SYNCD_BASE)_VERSION = 1.0.0 + $(DOCKER_SYNCD_BASE)_RUN_OPT += -v /host/warmboot:/var/warmboot $(DOCKER_SYNCD_BASE)_RUN_OPT += -v /var/run/docker-syncd:/var/run/sswsyncd diff --git a/platform/vs/docker-gbsyncd-vs.mk b/platform/vs/docker-gbsyncd-vs.mk index 2013132d6281..b19fad685009 100644 --- a/platform/vs/docker-gbsyncd-vs.mk +++ b/platform/vs/docker-gbsyncd-vs.mk @@ -11,4 +11,5 @@ $(DOCKER_GBSYNCD_BASE)_DBG_DEPENDS += $(SYNCD_VS_DBG) \ $(LIBSAIREDIS_DBG) \ $(LIBSAIVS_DBG) +$(DOCKER_GBSYNCD_BASE)_VERSION = 1.0.0 $(DOCKER_GBSYNCD_BASE)_RUN_OPT += -v /host/warmboot:/var/warmboot diff --git a/platform/vs/docker-syncd-vs.mk b/platform/vs/docker-syncd-vs.mk index 15d94c5854d2..3dd112ad4e91 100644 --- a/platform/vs/docker-syncd-vs.mk +++ b/platform/vs/docker-syncd-vs.mk @@ -11,4 +11,6 @@ $(DOCKER_SYNCD_BASE)_DBG_DEPENDS += $(SYNCD_VS_DBG) \ $(LIBSAIREDIS_DBG) \ $(LIBSAIVS_DBG) +$(DOCKER_SYNCD_BASE)_VERSION = 1.0.0 + $(DOCKER_SYNCD_BASE)_RUN_OPT += -v /host/warmboot:/var/warmboot diff --git a/rules/docker-database.mk b/rules/docker-database.mk index 0a2f46d19223..ab2ce3582662 100644 --- a/rules/docker-database.mk +++ b/rules/docker-database.mk @@ -12,6 +12,8 @@ $(DOCKER_DATABASE)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_IMA $(DOCKER_DATABASE)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER) +$(DOCKER_DATABASE)_VERSION = 1.0.0 + SONIC_DOCKER_IMAGES += $(DOCKER_DATABASE) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_DATABASE) diff --git a/rules/docker-dhcp-relay.mk b/rules/docker-dhcp-relay.mk index 860928bf8176..0412d2550247 100644 --- a/rules/docker-dhcp-relay.mk +++ b/rules/docker-dhcp-relay.mk @@ -14,6 +14,8 @@ $(DOCKER_DHCP_RELAY)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_I $(DOCKER_DHCP_RELAY)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE_BUSTER) +$(DOCKER_DHCP_RELAY)_VERSION = 1.0.0 + SONIC_DOCKER_IMAGES += $(DOCKER_DHCP_RELAY) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_DHCP_RELAY) diff --git a/rules/docker-fpm-frr.mk b/rules/docker-fpm-frr.mk index 833d510245ea..07516ef0a1e5 100644 --- a/rules/docker-fpm-frr.mk +++ b/rules/docker-fpm-frr.mk @@ -16,6 +16,8 @@ $(DOCKER_FPM_FRR)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_IMAG $(DOCKER_FPM_FRR)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER) +$(DOCKER_FPM_FRR)_VERSION = 1.0.0 + SONIC_DOCKER_IMAGES += $(DOCKER_FPM_FRR) SONIC_DOCKER_DBG_IMAGES += $(DOCKER_FPM_FRR_DBG) diff --git a/rules/docker-fpm-gobgp.mk b/rules/docker-fpm-gobgp.mk index 03ec88e85b56..8a285f3a6dc9 100644 --- a/rules/docker-fpm-gobgp.mk +++ b/rules/docker-fpm-gobgp.mk @@ -4,6 +4,9 @@ DOCKER_FPM_GOBGP = docker-fpm-gobgp.gz $(DOCKER_FPM_GOBGP)_PATH = $(DOCKERS_PATH)/docker-fpm-gobgp $(DOCKER_FPM_GOBGP)_DEPENDS += $(GOBGP) $(DOCKER_FPM_GOBGP)_LOAD_DOCKERS += $(DOCKER_FPM_QUAGGA) + +$(DOCKER_FPM_GOBGP)_VERSION = 1.0.0 + SONIC_DOCKER_IMAGES += $(DOCKER_FPM_GOBGP) $(DOCKER_FPM_GOBGP)_CONTAINER_NAME = bgp diff --git a/rules/docker-fpm-quagga.mk b/rules/docker-fpm-quagga.mk index 5a384eedab2c..ec77e7c32928 100644 --- a/rules/docker-fpm-quagga.mk +++ b/rules/docker-fpm-quagga.mk @@ -4,6 +4,9 @@ DOCKER_FPM_QUAGGA = docker-fpm-quagga.gz $(DOCKER_FPM_QUAGGA)_PATH = $(DOCKERS_PATH)/docker-fpm-quagga $(DOCKER_FPM_QUAGGA)_DEPENDS += $(QUAGGA) $(SWSS) $(DOCKER_FPM_QUAGGA)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) + +$(DOCKER_FPM_QUAGGA)_VERSION = 1.0.0 + SONIC_DOCKER_IMAGES += $(DOCKER_FPM_QUAGGA) $(DOCKER_FPM_QUAGGA)_CONTAINER_NAME = bgp diff --git a/rules/docker-iccpd.mk b/rules/docker-iccpd.mk index da77d9c9c1fd..aa29bdc3050e 100644 --- a/rules/docker-iccpd.mk +++ b/rules/docker-iccpd.mk @@ -10,6 +10,8 @@ $(DOCKER_ICCPD)_DBG_DEPENDS += $(SWSS_DBG) $(LIBSWSSCOMMON_DBG) $(ICCPD_DBG) $(DOCKER_ICCPD)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_IMAGE_PACKAGES) $(DOCKER_ICCPD)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER) +$(DOCKER_ICCPD)_VERSION = 1.0.0 + ifeq ($(INCLUDE_ICCPD), y) SONIC_DOCKER_IMAGES += $(DOCKER_ICCPD) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ICCPD) diff --git a/rules/docker-lldp.mk b/rules/docker-lldp.mk index 36c8a3a3536d..2ccf375e25cd 100644 --- a/rules/docker-lldp.mk +++ b/rules/docker-lldp.mk @@ -16,6 +16,8 @@ $(DOCKER_LLDP)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_IMAGE_P $(DOCKER_LLDP)_PYTHON_WHEELS += $(DBSYNCD_PY2) $(DOCKER_LLDP)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER) +$(DOCKER_LLDP)_VERSION = 1.0.0 + SONIC_DOCKER_IMAGES += $(DOCKER_LLDP) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_LLDP) diff --git a/rules/docker-nat.mk b/rules/docker-nat.mk index 981019dbcdb6..e84174088f0b 100644 --- a/rules/docker-nat.mk +++ b/rules/docker-nat.mk @@ -13,6 +13,8 @@ $(DOCKER_NAT)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_IMAGE_PA $(DOCKER_NAT)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER) +$(DOCKER_NAT)_VERSION = 1.0.0 + ifeq ($(INCLUDE_NAT), y) SONIC_DOCKER_IMAGES += $(DOCKER_NAT) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_NAT) diff --git a/rules/docker-orchagent.mk b/rules/docker-orchagent.mk index 5e2e08ee2437..91e9ea1623a0 100644 --- a/rules/docker-orchagent.mk +++ b/rules/docker-orchagent.mk @@ -17,6 +17,8 @@ $(DOCKER_ORCHAGENT)_PATH = $(DOCKERS_PATH)/$(DOCKER_ORCHAGENT_STEM) $(DOCKER_ORCHAGENT)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER) +$(DOCKER_ORCHAGENT)_VERSION = 1.0.0 + SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ORCHAGENT) diff --git a/rules/docker-platform-monitor.mk b/rules/docker-platform-monitor.mk index afe27d70e492..1307d0dee62b 100644 --- a/rules/docker-platform-monitor.mk +++ b/rules/docker-platform-monitor.mk @@ -35,6 +35,8 @@ $(DOCKER_PLATFORM_MONITOR)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER) $(DOCKER_PLATFORM_MONITOR)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE_BUSTER) +$(DOCKER_PLATFORM_MONITOR)_VERSION = 1.0.0 + SONIC_DOCKER_IMAGES += $(DOCKER_PLATFORM_MONITOR) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_PLATFORM_MONITOR) diff --git a/rules/docker-restapi.mk b/rules/docker-restapi.mk index ef56789dd759..d9d6bb34a311 100644 --- a/rules/docker-restapi.mk +++ b/rules/docker-restapi.mk @@ -10,6 +10,8 @@ $(DOCKER_RESTAPI)_PATH = $(DOCKERS_PATH)/$(DOCKER_RESTAPI_STEM) $(DOCKER_RESTAPI)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_STRETCH) +$(DOCKER_RESTAPI)_VERSION = 1.0.0 + ifeq ($(INCLUDE_RESTAPI), y) SONIC_DOCKER_IMAGES += $(DOCKER_RESTAPI) SONIC_STRETCH_DOCKERS += $(DOCKER_RESTAPI) diff --git a/rules/docker-router-advertiser.mk b/rules/docker-router-advertiser.mk index 3b9f7ae8ba01..adc06f4ea5f5 100644 --- a/rules/docker-router-advertiser.mk +++ b/rules/docker-router-advertiser.mk @@ -13,6 +13,8 @@ $(DOCKER_ROUTER_ADVERTISER)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER $(DOCKER_ROUTER_ADVERTISER)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE_BUSTER) +$(DOCKER_ROUTER_ADVERTISER)_VERSION = 1.0.0 + SONIC_DOCKER_IMAGES += $(DOCKER_ROUTER_ADVERTISER) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ROUTER_ADVERTISER) diff --git a/rules/docker-sflow.mk b/rules/docker-sflow.mk index 6888304b8bce..9a909e2d4723 100644 --- a/rules/docker-sflow.mk +++ b/rules/docker-sflow.mk @@ -13,6 +13,8 @@ $(DOCKER_SFLOW)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_IMAGE_ $(DOCKER_SFLOW)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER) +$(DOCKER_SFLOW)_VERSION = 1.0.0 + SONIC_DOCKER_IMAGES += $(DOCKER_SFLOW) ifeq ($(INCLUDE_SFLOW), y) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SFLOW) diff --git a/rules/docker-snmp.mk b/rules/docker-snmp.mk index 3493a2dfa337..7241f688faf9 100644 --- a/rules/docker-snmp.mk +++ b/rules/docker-snmp.mk @@ -17,6 +17,8 @@ $(DOCKER_SNMP)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_IMAGE_P $(DOCKER_SNMP)_PYTHON_WHEELS += $(SONIC_PY_COMMON_PY3) $(SONIC_PLATFORM_COMMON_PY3) $(SWSSSDK_PY3) $(ASYNCSNMP_PY3) $(DOCKER_SNMP)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER) +$(DOCKER_SNMP)_VERSION = 1.0.0 + SONIC_DOCKER_IMAGES += $(DOCKER_SNMP) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SNMP) diff --git a/rules/docker-sonic-mgmt-framework.mk b/rules/docker-sonic-mgmt-framework.mk index 65bac8bd9ddc..d0137ee034fb 100644 --- a/rules/docker-sonic-mgmt-framework.mk +++ b/rules/docker-sonic-mgmt-framework.mk @@ -13,6 +13,9 @@ $(DOCKER_MGMT_FRAMEWORK)_DBG_DEPENDS += $(SONIC_MGMT_FRAMEWORK_DBG) SONIC_DOCKER_IMAGES += $(DOCKER_MGMT_FRAMEWORK) $(DOCKER_MGMT_FRAMEWORK)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER) + +$(DOCKER_MGMT_FRAMEWORK)_VERSION = 1.0.0 + $(DOCKER_MGMT_FRAMEWORK)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_IMAGE_PACKAGES) ifeq ($(INCLUDE_MGMT_FRAMEWORK), y) diff --git a/rules/docker-teamd.mk b/rules/docker-teamd.mk index 5442d5bf6b3f..63c12196d5d6 100644 --- a/rules/docker-teamd.mk +++ b/rules/docker-teamd.mk @@ -15,6 +15,8 @@ $(DOCKER_TEAMD)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_IMAGE_ $(DOCKER_TEAMD)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER) +$(DOCKER_TEAMD)_VERSION = 1.0.0 + SONIC_DOCKER_IMAGES += $(DOCKER_TEAMD) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_TEAMD) diff --git a/rules/docker-telemetry.mk b/rules/docker-telemetry.mk index 15f90c74c810..dcd02a665722 100644 --- a/rules/docker-telemetry.mk +++ b/rules/docker-telemetry.mk @@ -11,6 +11,9 @@ $(DOCKER_TELEMETRY)_DEPENDS += $(SONIC_TELEMETRY) $(DOCKER_TELEMETRY)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_DEPENDS) $(DOCKER_TELEMETRY)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER) + +$(DOCKER_TELEMETRY)_VERSION = 1.0.0 + $(DOCKER_TELEMETRY)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_IMAGE_PACKAGES) SONIC_DOCKER_IMAGES += $(DOCKER_TELEMETRY) diff --git a/slave.mk b/slave.mk index a959936f1aa4..45abd73818af 100644 --- a/slave.mk +++ b/slave.mk @@ -868,7 +868,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ export enable_pfcwd_on_start="$(ENABLE_PFCWD_ON_START)" export installer_debs="$(addprefix $(IMAGE_DISTRO_DEBS_PATH)/,$($*_INSTALLS))" export lazy_installer_debs="$(foreach deb, $($*_LAZY_INSTALLS),$(foreach device, $($(deb)_PLATFORM),$(addprefix $(device)@, $(IMAGE_DISTRO_DEBS_PATH)/$(deb))))" - export installer_images="$(addprefix $(TARGET_PATH)/,$($*_DOCKERS))" + export installer_images="$(foreach docker, $($*_DOCKERS),$(addprefix $(TARGET_PATH)/,$(addsuffix :$($(docker)_VERSION),$(docker))))" export sonic_py_common_py2_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_PY_COMMON_PY2))" export sonic_py_common_py3_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_PY_COMMON_PY3))" export config_engine_py2_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_CONFIG_ENGINE_PY2))" From 875650f09e1e76f7f9ac6ca8d9a14f2271efcfe3 Mon Sep 17 00:00:00 2001 From: Stepan Blyschak Date: Mon, 14 Sep 2020 14:50:04 +0300 Subject: [PATCH 02/44] [dockers] Tag all docker images with a version number Previously all docker images built into SONiC binary were tagged with SONiC version string. With the introduction of container upgrades and SONiC extension framework all docker images should have their own version numbers that do not relate with SONiC version. All dockers are tagged with version 1.0.0 in this PR. Whenever changes are introduced to a docker image that require a version change, the docker image maintainer should update the version number. Signed-off-by: Stepan Blyschak --- files/build_templates/sonic_debian_extension.j2 | 10 ++++++---- platform/barefoot/docker-syncd-bfn-rpc.mk | 1 + platform/barefoot/docker-syncd-bfn.mk | 2 ++ platform/broadcom/docker-syncd-brcm-rpc.mk | 1 + platform/broadcom/docker-syncd-brcm.mk | 2 ++ platform/cavium/docker-syncd-cavm-rpc.mk | 1 + platform/cavium/docker-syncd-cavm.mk | 2 ++ platform/centec-arm64/docker-syncd-centec-rpc.mk | 1 + platform/centec-arm64/docker-syncd-centec.mk | 1 + platform/centec/docker-syncd-centec-rpc.mk | 1 + platform/centec/docker-syncd-centec.mk | 2 ++ platform/innovium/docker-syncd-invm-rpc.mk | 1 + platform/innovium/docker-syncd-invm.mk | 2 ++ platform/marvell-arm64/docker-syncd-mrvl-rpc.mk | 1 + platform/marvell-arm64/docker-syncd-mrvl.mk | 2 ++ platform/marvell-armhf/docker-syncd-mrvl-rpc.mk | 1 + platform/marvell-armhf/docker-syncd-mrvl.mk | 2 ++ platform/marvell/docker-syncd-mrvl-rpc.mk | 1 + platform/marvell/docker-syncd-mrvl.mk | 2 ++ platform/mellanox/docker-syncd-mlnx-rpc.mk | 1 + platform/mellanox/docker-syncd-mlnx.mk | 2 ++ platform/nephos/docker-syncd-nephos-rpc.mk | 1 + platform/nephos/docker-syncd-nephos.mk | 4 +++- platform/vs/docker-gbsyncd-vs.mk | 1 + platform/vs/docker-syncd-vs.mk | 2 ++ rules/docker-database.mk | 2 ++ rules/docker-dhcp-relay.mk | 2 ++ rules/docker-fpm-frr.mk | 2 ++ rules/docker-fpm-gobgp.mk | 3 +++ rules/docker-fpm-quagga.mk | 3 +++ rules/docker-iccpd.mk | 2 ++ rules/docker-lldp.mk | 2 ++ rules/docker-nat.mk | 2 ++ rules/docker-orchagent.mk | 2 ++ rules/docker-platform-monitor.mk | 2 ++ rules/docker-restapi.mk | 2 ++ rules/docker-router-advertiser.mk | 2 ++ rules/docker-sflow.mk | 2 ++ rules/docker-snmp.mk | 2 ++ rules/docker-sonic-mgmt-framework.mk | 3 +++ rules/docker-teamd.mk | 2 ++ rules/docker-telemetry.mk | 3 +++ slave.mk | 2 +- 43 files changed, 81 insertions(+), 6 deletions(-) diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 461c629284e7..1321ab2d4db3 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -523,13 +523,15 @@ sudo mkdir $FILESYSTEM_ROOT/target sudo mount --bind target $FILESYSTEM_ROOT/target sudo chroot $FILESYSTEM_ROOT docker $SONIC_NATIVE_DOCKERD_FOR_DOCKERFS info {% for image in installer_images.strip().split(' ') -%} -{% set imagefilename = image.split('/')|last -%} +{% set imagefilepath = image.split(':')|first -%} +{% set imageversion = image.split(':')|last -%} +{% set imagefilename = imagefilepath.split('/')|last -%} {% set imagename = imagefilename.split('.')|first -%} -sudo LANG=C chroot $FILESYSTEM_ROOT docker $SONIC_NATIVE_DOCKERD_FOR_DOCKERFS load -i {{image}} -sudo LANG=C chroot $FILESYSTEM_ROOT docker $SONIC_NATIVE_DOCKERD_FOR_DOCKERFS tag {{imagename}}:latest {{imagename}}:"${SONIC_IMAGE_VERSION}" +sudo LANG=C chroot $FILESYSTEM_ROOT docker $SONIC_NATIVE_DOCKERD_FOR_DOCKERFS load -i {{imagefilepath}} +sudo LANG=C chroot $FILESYSTEM_ROOT docker $SONIC_NATIVE_DOCKERD_FOR_DOCKERFS tag {{imagename}}:latest {{imagename}}:{{imageversion}} {% if imagename.endswith('-dbg') %} {% set imagebasename = imagename.replace('-dbg', '') -%} -sudo LANG=C chroot $FILESYSTEM_ROOT docker $SONIC_NATIVE_DOCKERD_FOR_DOCKERFS tag {{imagename}}:latest {{imagebasename}}:"${SONIC_IMAGE_VERSION}" +sudo LANG=C chroot $FILESYSTEM_ROOT docker $SONIC_NATIVE_DOCKERD_FOR_DOCKERFS tag {{imagename}}:latest {{imagebasename}}:{{imageversion}} sudo LANG=C chroot $FILESYSTEM_ROOT docker $SONIC_NATIVE_DOCKERD_FOR_DOCKERFS tag {{imagename}}:latest {{imagebasename}}:latest {% endif %} {% endfor %} diff --git a/platform/barefoot/docker-syncd-bfn-rpc.mk b/platform/barefoot/docker-syncd-bfn-rpc.mk index 11b70a3a774f..41c55b1bcf7d 100644 --- a/platform/barefoot/docker-syncd-bfn-rpc.mk +++ b/platform/barefoot/docker-syncd-bfn-rpc.mk @@ -18,6 +18,7 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_BFN_RPC) endif $(DOCKER_SYNCD_BFN_RPC)_CONTAINER_NAME = syncd +$(DOCKER_SYNCD_BFN_RPC)_VERSION = 1.0.0 $(DOCKER_SYNCD_BFN_RPC)_RUN_OPT += --net=host --privileged -t $(DOCKER_SYNCD_BFN_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf $(DOCKER_SYNCD_BFN_RPC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro diff --git a/platform/barefoot/docker-syncd-bfn.mk b/platform/barefoot/docker-syncd-bfn.mk index ae4ca9d9f272..d3d018393b47 100644 --- a/platform/barefoot/docker-syncd-bfn.mk +++ b/platform/barefoot/docker-syncd-bfn.mk @@ -10,6 +10,8 @@ $(DOCKER_SYNCD_BASE)_DBG_DEPENDS += $(SYNCD_DBG) \ $(LIBSAIMETADATA_DBG) \ $(LIBSAIREDIS_DBG) +$(DOCKER_SYNCD_BASE)_VERSION = 1.0.0 + SONIC_STRETCH_DOCKERS += $(DOCKER_SYNCD_BASE) SONIC_STRETCH_DBG_DOCKERS += $(DOCKER_SYNCD_BASE_DBG) diff --git a/platform/broadcom/docker-syncd-brcm-rpc.mk b/platform/broadcom/docker-syncd-brcm-rpc.mk index b1a58232927d..ca9bfaac54dd 100644 --- a/platform/broadcom/docker-syncd-brcm-rpc.mk +++ b/platform/broadcom/docker-syncd-brcm-rpc.mk @@ -18,6 +18,7 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_BRCM_RPC) endif $(DOCKER_SYNCD_BRCM_RPC)_CONTAINER_NAME = syncd +$(DOCKER_SYNCD_BRCM_RPC)_VERSION = 1.0.0 $(DOCKER_SYNCD_BRCM_RPC)_RUN_OPT += --privileged -t $(DOCKER_SYNCD_BRCM_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf $(DOCKER_SYNCD_BRCM_RPC)_RUN_OPT += -v /host/warmboot:/var/warmboot diff --git a/platform/broadcom/docker-syncd-brcm.mk b/platform/broadcom/docker-syncd-brcm.mk index b1b412fc9edd..3b59a99f9131 100644 --- a/platform/broadcom/docker-syncd-brcm.mk +++ b/platform/broadcom/docker-syncd-brcm.mk @@ -14,6 +14,8 @@ $(DOCKER_SYNCD_BASE)_DBG_DEPENDS += $(SYNCD_DBG) \ SONIC_STRETCH_DOCKERS += $(DOCKER_SYNCD_BASE) SONIC_STRETCH_DBG_DOCKERS += $(DOCKER_SYNCD_BASE_DBG) +$(DOCKER_SYNCD_BASE)_VERSION = 1.0.0 + $(DOCKER_SYNCD_BASE)_RUN_OPT += -v /host/warmboot:/var/warmboot $(DOCKER_SYNCD_BASE)_BASE_IMAGE_FILES += bcmcmd:/usr/bin/bcmcmd diff --git a/platform/cavium/docker-syncd-cavm-rpc.mk b/platform/cavium/docker-syncd-cavm-rpc.mk index a19124609bb0..10a47d31b32b 100644 --- a/platform/cavium/docker-syncd-cavm-rpc.mk +++ b/platform/cavium/docker-syncd-cavm-rpc.mk @@ -17,6 +17,7 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_CAVM_RPC) endif $(DOCKER_SYNCD_CAVM_RPC)_CONTAINER_NAME = syncd +$(DOCKER_SYNCD_CAVM_RPC)_VERSION = 1.0.0 $(DOCKER_SYNCD_CAVM_RPC)_RUN_OPT += --net=host --privileged -t $(DOCKER_SYNCD_CAVM_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf $(DOCKER_SYNCD_CAVM_RPC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro diff --git a/platform/cavium/docker-syncd-cavm.mk b/platform/cavium/docker-syncd-cavm.mk index 059d2c71ebb4..02b1a6d73f83 100644 --- a/platform/cavium/docker-syncd-cavm.mk +++ b/platform/cavium/docker-syncd-cavm.mk @@ -16,6 +16,8 @@ ifneq ($(ENABLE_SYNCD_RPC),y) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_CAVM) endif +$(DOCKER_SYNCD_BASE)_VERSION = 1.0.0 + $(DOCKER_SYNCD_CAVM)_CONTAINER_NAME = syncd $(DOCKER_SYNCD_CAVM)_RUN_OPT += --net=host --privileged -t $(DOCKER_SYNCD_CAVM)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf diff --git a/platform/centec-arm64/docker-syncd-centec-rpc.mk b/platform/centec-arm64/docker-syncd-centec-rpc.mk index 8d699c91347f..e66089249622 100755 --- a/platform/centec-arm64/docker-syncd-centec-rpc.mk +++ b/platform/centec-arm64/docker-syncd-centec-rpc.mk @@ -18,6 +18,7 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_CENTEC_RPC) endif $(DOCKER_SYNCD_CENTEC_RPC)_CONTAINER_NAME = syncd +$(DOCKER_SYNCD_CENTEC_RPC)_VERSION = 1.0.0 $(DOCKER_SYNCD_CENTEC_RPC)_RUN_OPT += --privileged -t $(DOCKER_SYNCD_CENTEC_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf $(DOCKER_SYNCD_CENTEC_RPC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro diff --git a/platform/centec-arm64/docker-syncd-centec.mk b/platform/centec-arm64/docker-syncd-centec.mk index 9943420660a4..e9db642b026e 100755 --- a/platform/centec-arm64/docker-syncd-centec.mk +++ b/platform/centec-arm64/docker-syncd-centec.mk @@ -13,6 +13,7 @@ $(DOCKER_SYNCD_BASE)_DBG_DEPENDS += $(SYNCD_DBG) \ SONIC_STRETCH_DOCKERS += $(DOCKER_SYNCD_BASE) SONIC_STRETCH_DBG_DOCKERS += $(DOCKER_SYNCD_BASE_DBG) +$(DOCKER_SYNCD_BASE)_VERSION = 1.0.0 $(DOCKER_SYNCD_BASE)_RUN_OPT += -v /host/warmboot:/var/warmboot $(DOCKER_SYNCD_CENTEC)_RUN_OPT += --privileged -t $(DOCKER_SYNCD_CENTEC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf diff --git a/platform/centec/docker-syncd-centec-rpc.mk b/platform/centec/docker-syncd-centec-rpc.mk index 8915f1c35679..b5b98e7bee4e 100644 --- a/platform/centec/docker-syncd-centec-rpc.mk +++ b/platform/centec/docker-syncd-centec-rpc.mk @@ -18,6 +18,7 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_CENTEC_RPC) endif $(DOCKER_SYNCD_CENTEC_RPC)_CONTAINER_NAME = syncd +$(DOCKER_SYNCD_CENTEC_RPC)_VERSION = 1.0.0 $(DOCKER_SYNCD_CENTEC_RPC)_RUN_OPT += --privileged -t $(DOCKER_SYNCD_CENTEC_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf $(DOCKER_SYNCD_CENTEC_RPC)_RUN_OPT += -v /var/run/docker-syncd:/var/run/sswsyncd diff --git a/platform/centec/docker-syncd-centec.mk b/platform/centec/docker-syncd-centec.mk index ada63a218d4a..d5d819f2235a 100644 --- a/platform/centec/docker-syncd-centec.mk +++ b/platform/centec/docker-syncd-centec.mk @@ -13,6 +13,8 @@ $(DOCKER_SYNCD_CENTEC)_DEPENDS += $(SYNCD_DBG) \ SONIC_STRETCH_DOCKERS += $(DOCKER_SYNCD_BASE) SONIC_STRETCH_DBG_DOCKERS += $(DOCKER_SYNCD_BASE_DBG) +$(DOCKER_SYNCD_BASE)_VERSION = 1.0.0 + $(DOCKER_SYNCD_CENTEC)_RUN_OPT += --privileged -t $(DOCKER_SYNCD_CENTEC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf $(DOCKER_SYNCD_CENTEC)_RUN_OPT += -v /var/run/docker-syncd:/var/run/sswsyncd diff --git a/platform/innovium/docker-syncd-invm-rpc.mk b/platform/innovium/docker-syncd-invm-rpc.mk index 62d6891bbc21..de4cce280c70 100755 --- a/platform/innovium/docker-syncd-invm-rpc.mk +++ b/platform/innovium/docker-syncd-invm-rpc.mk @@ -10,6 +10,7 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_INVM_RPC) endif $(DOCKER_SYNCD_INVM_RPC)_CONTAINER_NAME = syncd +$(DOCKER_SYNCD_INVM_RPC)_VERSION = 1.0.0 $(DOCKER_SYNCD_INVM_RPC)_RUN_OPT += --net=host --privileged -t $(DOCKER_SYNCD_INVM_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf $(DOCKER_SYNCD_INVM_RPC)_RUN_OPT += -v /var/run/docker-syncd:/var/run/sswsyncd diff --git a/platform/innovium/docker-syncd-invm.mk b/platform/innovium/docker-syncd-invm.mk index 52c11b90911d..75d0a1d4933b 100755 --- a/platform/innovium/docker-syncd-invm.mk +++ b/platform/innovium/docker-syncd-invm.mk @@ -13,4 +13,6 @@ $(DOCKER_SYNCD_BASE)_DBG_DEPENDS += $(SYNCD_DBG) \ SONIC_STRETCH_DOCKERS += $(DOCKER_SYNCD_BASE) SONIC_STRETCH_DBG_DOCKERS += $(DOCKER_SYNCD_BASE_DBG) +$(DOCKER_SYNCD_BASE)_VERSION = 1.0.0 + $(DOCKER_SYNCD_BASE)_RUN_OPT += -v /host/warmboot:/var/warmboot diff --git a/platform/marvell-arm64/docker-syncd-mrvl-rpc.mk b/platform/marvell-arm64/docker-syncd-mrvl-rpc.mk index c3ce6c10119c..4d5b445cfbf7 100644 --- a/platform/marvell-arm64/docker-syncd-mrvl-rpc.mk +++ b/platform/marvell-arm64/docker-syncd-mrvl-rpc.mk @@ -18,6 +18,7 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_MRVL_RPC) endif $(DOCKER_SYNCD_MRVL_RPC)_CONTAINER_NAME = syncd +$(DOCKER_SYNCD_MRVL_RPC)_VERSION = 1.0.0 $(DOCKER_SYNCD_MRVL_RPC)_RUN_OPT += --net=host --privileged -t $(DOCKER_SYNCD_MRVL_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf $(DOCKER_SYNCD_MRVL_RPC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro diff --git a/platform/marvell-arm64/docker-syncd-mrvl.mk b/platform/marvell-arm64/docker-syncd-mrvl.mk index dd01caab687b..2b8fc7f9d2ca 100644 --- a/platform/marvell-arm64/docker-syncd-mrvl.mk +++ b/platform/marvell-arm64/docker-syncd-mrvl.mk @@ -13,5 +13,7 @@ $(DOCKER_SYNCD_BASE)_DBG_DEPENDS += $(SYNCD_DBG) \ SONIC_STRETCH_DOCKERS += $(DOCKER_SYNCD_BASE) SONIC_STRETCH_DBG_DOCKERS += $(DOCKER_SYNCD_BASE_DBG) +$(DOCKER_SYNCD_BASE)_VERSION = 1.0.0 + $(DOCKER_SYNCD_BASE)_RUN_OPT += -v /host/warmboot:/var/warmboot $(DOCKER_SYNCD_BASE)_BASE_IMAGE_FILES += monit_syncd:/etc/monit/conf.d diff --git a/platform/marvell-armhf/docker-syncd-mrvl-rpc.mk b/platform/marvell-armhf/docker-syncd-mrvl-rpc.mk index c3ce6c10119c..4d5b445cfbf7 100644 --- a/platform/marvell-armhf/docker-syncd-mrvl-rpc.mk +++ b/platform/marvell-armhf/docker-syncd-mrvl-rpc.mk @@ -18,6 +18,7 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_MRVL_RPC) endif $(DOCKER_SYNCD_MRVL_RPC)_CONTAINER_NAME = syncd +$(DOCKER_SYNCD_MRVL_RPC)_VERSION = 1.0.0 $(DOCKER_SYNCD_MRVL_RPC)_RUN_OPT += --net=host --privileged -t $(DOCKER_SYNCD_MRVL_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf $(DOCKER_SYNCD_MRVL_RPC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro diff --git a/platform/marvell-armhf/docker-syncd-mrvl.mk b/platform/marvell-armhf/docker-syncd-mrvl.mk index dd01caab687b..2b8fc7f9d2ca 100644 --- a/platform/marvell-armhf/docker-syncd-mrvl.mk +++ b/platform/marvell-armhf/docker-syncd-mrvl.mk @@ -13,5 +13,7 @@ $(DOCKER_SYNCD_BASE)_DBG_DEPENDS += $(SYNCD_DBG) \ SONIC_STRETCH_DOCKERS += $(DOCKER_SYNCD_BASE) SONIC_STRETCH_DBG_DOCKERS += $(DOCKER_SYNCD_BASE_DBG) +$(DOCKER_SYNCD_BASE)_VERSION = 1.0.0 + $(DOCKER_SYNCD_BASE)_RUN_OPT += -v /host/warmboot:/var/warmboot $(DOCKER_SYNCD_BASE)_BASE_IMAGE_FILES += monit_syncd:/etc/monit/conf.d diff --git a/platform/marvell/docker-syncd-mrvl-rpc.mk b/platform/marvell/docker-syncd-mrvl-rpc.mk index c3ce6c10119c..4d5b445cfbf7 100644 --- a/platform/marvell/docker-syncd-mrvl-rpc.mk +++ b/platform/marvell/docker-syncd-mrvl-rpc.mk @@ -18,6 +18,7 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_MRVL_RPC) endif $(DOCKER_SYNCD_MRVL_RPC)_CONTAINER_NAME = syncd +$(DOCKER_SYNCD_MRVL_RPC)_VERSION = 1.0.0 $(DOCKER_SYNCD_MRVL_RPC)_RUN_OPT += --net=host --privileged -t $(DOCKER_SYNCD_MRVL_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf $(DOCKER_SYNCD_MRVL_RPC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro diff --git a/platform/marvell/docker-syncd-mrvl.mk b/platform/marvell/docker-syncd-mrvl.mk index d6d7d032b8ac..4cac777bf9e5 100644 --- a/platform/marvell/docker-syncd-mrvl.mk +++ b/platform/marvell/docker-syncd-mrvl.mk @@ -13,6 +13,8 @@ $(DOCKER_SYNCD_BASE)_DBG_DEPENDS += $(SYNCD_DBG) \ SONIC_STRETCH_DOCKERS += $(DOCKER_SYNCD_BASE) SONIC_STRETCH_DBG_DOCKERS += $(DOCKER_SYNCD_BASE_DBG) +$(DOCKER_SYNCD_BASE)_VERSION = 1.0.0 + $(DOCKER_SYNCD_BASE)_RUN_OPT += -v /host/warmboot:/var/warmboot $(DOCKER_SYNCD_BASE)_RUN_OPT += -v /var/run/docker-syncd:/var/run/sswsyncd $(DOCKER_SYNCD_BASE)_BASE_IMAGE_FILES += monit_syncd:/etc/monit/conf.d diff --git a/platform/mellanox/docker-syncd-mlnx-rpc.mk b/platform/mellanox/docker-syncd-mlnx-rpc.mk index 806b40035f23..dcdc79d36b59 100644 --- a/platform/mellanox/docker-syncd-mlnx-rpc.mk +++ b/platform/mellanox/docker-syncd-mlnx-rpc.mk @@ -20,6 +20,7 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_MLNX_RPC) endif $(DOCKER_SYNCD_MLNX_RPC)_CONTAINER_NAME = syncd +$(DOCKER_SYNCD_MLNX_RPC)_VERSION = 1.0.0 $(DOCKER_SYNCD_MLNX_RPC)_RUN_OPT += --privileged -t $(DOCKER_SYNCD_MLNX_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf $(DOCKER_SYNCD_MLNX_RPC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro diff --git a/platform/mellanox/docker-syncd-mlnx.mk b/platform/mellanox/docker-syncd-mlnx.mk index 9bdc5a8ad8ec..c98cbebc01f2 100644 --- a/platform/mellanox/docker-syncd-mlnx.mk +++ b/platform/mellanox/docker-syncd-mlnx.mk @@ -14,5 +14,7 @@ ifeq ($(SDK_FROM_SRC), y) $(DOCKER_SYNCD_BASE)_DBG_DEPENDS += $(MLNX_SDK_DBG_DEBS) $(MLNX_SAI_DBGSYM) endif +$(DOCKER_SYNCD_BASE)_VERSION = 1.0.0 + $(DOCKER_SYNCD_BASE)_RUN_OPT += -v /host/warmboot:/var/warmboot $(DOCKER_SYNCD_BASE)_BASE_IMAGE_FILES += monit_syncd:/etc/monit/conf.d diff --git a/platform/nephos/docker-syncd-nephos-rpc.mk b/platform/nephos/docker-syncd-nephos-rpc.mk index 39240c1913e4..8d3eeb55b01c 100644 --- a/platform/nephos/docker-syncd-nephos-rpc.mk +++ b/platform/nephos/docker-syncd-nephos-rpc.mk @@ -18,6 +18,7 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_NEPHOS_RPC) endif $(DOCKER_SYNCD_NEPHOS_RPC)_CONTAINER_NAME = syncd +$(DOCKER_SYNCD_NEPHOS_RPC)_VERSION = 1.0.0 $(DOCKER_SYNCD_NEPHOS_RPC)_RUN_OPT += --net=host --privileged -t $(DOCKER_SYNCD_NEPHOS_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf $(DOCKER_SYNCD_NEPHOS_RPC)_RUN_OPT += -v /host/warmboot:/var/warmboot diff --git a/platform/nephos/docker-syncd-nephos.mk b/platform/nephos/docker-syncd-nephos.mk index 146523ec1c64..f61320cdfaca 100644 --- a/platform/nephos/docker-syncd-nephos.mk +++ b/platform/nephos/docker-syncd-nephos.mk @@ -10,10 +10,12 @@ $(DOCKER_SYNCD_BASE)_DBG_DEPENDS += $(SYNCD_DBG) \ $(LIBSWSSCOMMON_DBG) \ $(LIBSAIMETADATA_DBG) \ $(LIBSAIREDIS_DBG) - + SONIC_STRETCH_DOCKERS += $(DOCKER_SYNCD_BASE) SONIC_STRETCH_DBG_DOCKERS += $(DOCKER_SYNCD_BASE_DBG) +$(DOCKER_SYNCD_BASE)_VERSION = 1.0.0 + $(DOCKER_SYNCD_BASE)_RUN_OPT += -v /host/warmboot:/var/warmboot $(DOCKER_SYNCD_BASE)_RUN_OPT += -v /var/run/docker-syncd:/var/run/sswsyncd diff --git a/platform/vs/docker-gbsyncd-vs.mk b/platform/vs/docker-gbsyncd-vs.mk index 2013132d6281..b19fad685009 100644 --- a/platform/vs/docker-gbsyncd-vs.mk +++ b/platform/vs/docker-gbsyncd-vs.mk @@ -11,4 +11,5 @@ $(DOCKER_GBSYNCD_BASE)_DBG_DEPENDS += $(SYNCD_VS_DBG) \ $(LIBSAIREDIS_DBG) \ $(LIBSAIVS_DBG) +$(DOCKER_GBSYNCD_BASE)_VERSION = 1.0.0 $(DOCKER_GBSYNCD_BASE)_RUN_OPT += -v /host/warmboot:/var/warmboot diff --git a/platform/vs/docker-syncd-vs.mk b/platform/vs/docker-syncd-vs.mk index 15d94c5854d2..3dd112ad4e91 100644 --- a/platform/vs/docker-syncd-vs.mk +++ b/platform/vs/docker-syncd-vs.mk @@ -11,4 +11,6 @@ $(DOCKER_SYNCD_BASE)_DBG_DEPENDS += $(SYNCD_VS_DBG) \ $(LIBSAIREDIS_DBG) \ $(LIBSAIVS_DBG) +$(DOCKER_SYNCD_BASE)_VERSION = 1.0.0 + $(DOCKER_SYNCD_BASE)_RUN_OPT += -v /host/warmboot:/var/warmboot diff --git a/rules/docker-database.mk b/rules/docker-database.mk index 0a2f46d19223..ab2ce3582662 100644 --- a/rules/docker-database.mk +++ b/rules/docker-database.mk @@ -12,6 +12,8 @@ $(DOCKER_DATABASE)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_IMA $(DOCKER_DATABASE)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER) +$(DOCKER_DATABASE)_VERSION = 1.0.0 + SONIC_DOCKER_IMAGES += $(DOCKER_DATABASE) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_DATABASE) diff --git a/rules/docker-dhcp-relay.mk b/rules/docker-dhcp-relay.mk index 860928bf8176..0412d2550247 100644 --- a/rules/docker-dhcp-relay.mk +++ b/rules/docker-dhcp-relay.mk @@ -14,6 +14,8 @@ $(DOCKER_DHCP_RELAY)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_I $(DOCKER_DHCP_RELAY)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE_BUSTER) +$(DOCKER_DHCP_RELAY)_VERSION = 1.0.0 + SONIC_DOCKER_IMAGES += $(DOCKER_DHCP_RELAY) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_DHCP_RELAY) diff --git a/rules/docker-fpm-frr.mk b/rules/docker-fpm-frr.mk index 833d510245ea..07516ef0a1e5 100644 --- a/rules/docker-fpm-frr.mk +++ b/rules/docker-fpm-frr.mk @@ -16,6 +16,8 @@ $(DOCKER_FPM_FRR)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_IMAG $(DOCKER_FPM_FRR)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER) +$(DOCKER_FPM_FRR)_VERSION = 1.0.0 + SONIC_DOCKER_IMAGES += $(DOCKER_FPM_FRR) SONIC_DOCKER_DBG_IMAGES += $(DOCKER_FPM_FRR_DBG) diff --git a/rules/docker-fpm-gobgp.mk b/rules/docker-fpm-gobgp.mk index 03ec88e85b56..8a285f3a6dc9 100644 --- a/rules/docker-fpm-gobgp.mk +++ b/rules/docker-fpm-gobgp.mk @@ -4,6 +4,9 @@ DOCKER_FPM_GOBGP = docker-fpm-gobgp.gz $(DOCKER_FPM_GOBGP)_PATH = $(DOCKERS_PATH)/docker-fpm-gobgp $(DOCKER_FPM_GOBGP)_DEPENDS += $(GOBGP) $(DOCKER_FPM_GOBGP)_LOAD_DOCKERS += $(DOCKER_FPM_QUAGGA) + +$(DOCKER_FPM_GOBGP)_VERSION = 1.0.0 + SONIC_DOCKER_IMAGES += $(DOCKER_FPM_GOBGP) $(DOCKER_FPM_GOBGP)_CONTAINER_NAME = bgp diff --git a/rules/docker-fpm-quagga.mk b/rules/docker-fpm-quagga.mk index 5a384eedab2c..ec77e7c32928 100644 --- a/rules/docker-fpm-quagga.mk +++ b/rules/docker-fpm-quagga.mk @@ -4,6 +4,9 @@ DOCKER_FPM_QUAGGA = docker-fpm-quagga.gz $(DOCKER_FPM_QUAGGA)_PATH = $(DOCKERS_PATH)/docker-fpm-quagga $(DOCKER_FPM_QUAGGA)_DEPENDS += $(QUAGGA) $(SWSS) $(DOCKER_FPM_QUAGGA)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) + +$(DOCKER_FPM_QUAGGA)_VERSION = 1.0.0 + SONIC_DOCKER_IMAGES += $(DOCKER_FPM_QUAGGA) $(DOCKER_FPM_QUAGGA)_CONTAINER_NAME = bgp diff --git a/rules/docker-iccpd.mk b/rules/docker-iccpd.mk index da77d9c9c1fd..aa29bdc3050e 100644 --- a/rules/docker-iccpd.mk +++ b/rules/docker-iccpd.mk @@ -10,6 +10,8 @@ $(DOCKER_ICCPD)_DBG_DEPENDS += $(SWSS_DBG) $(LIBSWSSCOMMON_DBG) $(ICCPD_DBG) $(DOCKER_ICCPD)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_IMAGE_PACKAGES) $(DOCKER_ICCPD)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER) +$(DOCKER_ICCPD)_VERSION = 1.0.0 + ifeq ($(INCLUDE_ICCPD), y) SONIC_DOCKER_IMAGES += $(DOCKER_ICCPD) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ICCPD) diff --git a/rules/docker-lldp.mk b/rules/docker-lldp.mk index 36c8a3a3536d..2ccf375e25cd 100644 --- a/rules/docker-lldp.mk +++ b/rules/docker-lldp.mk @@ -16,6 +16,8 @@ $(DOCKER_LLDP)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_IMAGE_P $(DOCKER_LLDP)_PYTHON_WHEELS += $(DBSYNCD_PY2) $(DOCKER_LLDP)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER) +$(DOCKER_LLDP)_VERSION = 1.0.0 + SONIC_DOCKER_IMAGES += $(DOCKER_LLDP) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_LLDP) diff --git a/rules/docker-nat.mk b/rules/docker-nat.mk index 981019dbcdb6..e84174088f0b 100644 --- a/rules/docker-nat.mk +++ b/rules/docker-nat.mk @@ -13,6 +13,8 @@ $(DOCKER_NAT)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_IMAGE_PA $(DOCKER_NAT)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER) +$(DOCKER_NAT)_VERSION = 1.0.0 + ifeq ($(INCLUDE_NAT), y) SONIC_DOCKER_IMAGES += $(DOCKER_NAT) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_NAT) diff --git a/rules/docker-orchagent.mk b/rules/docker-orchagent.mk index 5e2e08ee2437..91e9ea1623a0 100644 --- a/rules/docker-orchagent.mk +++ b/rules/docker-orchagent.mk @@ -17,6 +17,8 @@ $(DOCKER_ORCHAGENT)_PATH = $(DOCKERS_PATH)/$(DOCKER_ORCHAGENT_STEM) $(DOCKER_ORCHAGENT)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER) +$(DOCKER_ORCHAGENT)_VERSION = 1.0.0 + SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ORCHAGENT) diff --git a/rules/docker-platform-monitor.mk b/rules/docker-platform-monitor.mk index afe27d70e492..1307d0dee62b 100644 --- a/rules/docker-platform-monitor.mk +++ b/rules/docker-platform-monitor.mk @@ -35,6 +35,8 @@ $(DOCKER_PLATFORM_MONITOR)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER) $(DOCKER_PLATFORM_MONITOR)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE_BUSTER) +$(DOCKER_PLATFORM_MONITOR)_VERSION = 1.0.0 + SONIC_DOCKER_IMAGES += $(DOCKER_PLATFORM_MONITOR) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_PLATFORM_MONITOR) diff --git a/rules/docker-restapi.mk b/rules/docker-restapi.mk index ef56789dd759..d9d6bb34a311 100644 --- a/rules/docker-restapi.mk +++ b/rules/docker-restapi.mk @@ -10,6 +10,8 @@ $(DOCKER_RESTAPI)_PATH = $(DOCKERS_PATH)/$(DOCKER_RESTAPI_STEM) $(DOCKER_RESTAPI)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_STRETCH) +$(DOCKER_RESTAPI)_VERSION = 1.0.0 + ifeq ($(INCLUDE_RESTAPI), y) SONIC_DOCKER_IMAGES += $(DOCKER_RESTAPI) SONIC_STRETCH_DOCKERS += $(DOCKER_RESTAPI) diff --git a/rules/docker-router-advertiser.mk b/rules/docker-router-advertiser.mk index 3b9f7ae8ba01..adc06f4ea5f5 100644 --- a/rules/docker-router-advertiser.mk +++ b/rules/docker-router-advertiser.mk @@ -13,6 +13,8 @@ $(DOCKER_ROUTER_ADVERTISER)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER $(DOCKER_ROUTER_ADVERTISER)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE_BUSTER) +$(DOCKER_ROUTER_ADVERTISER)_VERSION = 1.0.0 + SONIC_DOCKER_IMAGES += $(DOCKER_ROUTER_ADVERTISER) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ROUTER_ADVERTISER) diff --git a/rules/docker-sflow.mk b/rules/docker-sflow.mk index 6888304b8bce..9a909e2d4723 100644 --- a/rules/docker-sflow.mk +++ b/rules/docker-sflow.mk @@ -13,6 +13,8 @@ $(DOCKER_SFLOW)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_IMAGE_ $(DOCKER_SFLOW)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER) +$(DOCKER_SFLOW)_VERSION = 1.0.0 + SONIC_DOCKER_IMAGES += $(DOCKER_SFLOW) ifeq ($(INCLUDE_SFLOW), y) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SFLOW) diff --git a/rules/docker-snmp.mk b/rules/docker-snmp.mk index 3493a2dfa337..7241f688faf9 100644 --- a/rules/docker-snmp.mk +++ b/rules/docker-snmp.mk @@ -17,6 +17,8 @@ $(DOCKER_SNMP)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_IMAGE_P $(DOCKER_SNMP)_PYTHON_WHEELS += $(SONIC_PY_COMMON_PY3) $(SONIC_PLATFORM_COMMON_PY3) $(SWSSSDK_PY3) $(ASYNCSNMP_PY3) $(DOCKER_SNMP)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER) +$(DOCKER_SNMP)_VERSION = 1.0.0 + SONIC_DOCKER_IMAGES += $(DOCKER_SNMP) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SNMP) diff --git a/rules/docker-sonic-mgmt-framework.mk b/rules/docker-sonic-mgmt-framework.mk index 65bac8bd9ddc..d0137ee034fb 100644 --- a/rules/docker-sonic-mgmt-framework.mk +++ b/rules/docker-sonic-mgmt-framework.mk @@ -13,6 +13,9 @@ $(DOCKER_MGMT_FRAMEWORK)_DBG_DEPENDS += $(SONIC_MGMT_FRAMEWORK_DBG) SONIC_DOCKER_IMAGES += $(DOCKER_MGMT_FRAMEWORK) $(DOCKER_MGMT_FRAMEWORK)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER) + +$(DOCKER_MGMT_FRAMEWORK)_VERSION = 1.0.0 + $(DOCKER_MGMT_FRAMEWORK)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_IMAGE_PACKAGES) ifeq ($(INCLUDE_MGMT_FRAMEWORK), y) diff --git a/rules/docker-teamd.mk b/rules/docker-teamd.mk index 5442d5bf6b3f..63c12196d5d6 100644 --- a/rules/docker-teamd.mk +++ b/rules/docker-teamd.mk @@ -15,6 +15,8 @@ $(DOCKER_TEAMD)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_IMAGE_ $(DOCKER_TEAMD)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER) +$(DOCKER_TEAMD)_VERSION = 1.0.0 + SONIC_DOCKER_IMAGES += $(DOCKER_TEAMD) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_TEAMD) diff --git a/rules/docker-telemetry.mk b/rules/docker-telemetry.mk index 15f90c74c810..dcd02a665722 100644 --- a/rules/docker-telemetry.mk +++ b/rules/docker-telemetry.mk @@ -11,6 +11,9 @@ $(DOCKER_TELEMETRY)_DEPENDS += $(SONIC_TELEMETRY) $(DOCKER_TELEMETRY)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_DEPENDS) $(DOCKER_TELEMETRY)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER) + +$(DOCKER_TELEMETRY)_VERSION = 1.0.0 + $(DOCKER_TELEMETRY)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_IMAGE_PACKAGES) SONIC_DOCKER_IMAGES += $(DOCKER_TELEMETRY) diff --git a/slave.mk b/slave.mk index 88d64e6bc409..173e2716f8c2 100644 --- a/slave.mk +++ b/slave.mk @@ -868,7 +868,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ export enable_pfcwd_on_start="$(ENABLE_PFCWD_ON_START)" export installer_debs="$(addprefix $(IMAGE_DISTRO_DEBS_PATH)/,$($*_INSTALLS))" export lazy_installer_debs="$(foreach deb, $($*_LAZY_INSTALLS),$(foreach device, $($(deb)_PLATFORM),$(addprefix $(device)@, $(IMAGE_DISTRO_DEBS_PATH)/$(deb))))" - export installer_images="$(addprefix $(TARGET_PATH)/,$($*_DOCKERS))" + export installer_images="$(foreach docker, $($*_DOCKERS),$(addprefix $(TARGET_PATH)/,$(addsuffix :$($(docker)_VERSION),$(docker))))" export sonic_py_common_py2_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_PY_COMMON_PY2))" export sonic_py_common_py3_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_PY_COMMON_PY3))" export config_engine_py2_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_CONFIG_ENGINE_PY2))" From 954cad9f40d18b8967aba0e92baca99b06bd11e8 Mon Sep 17 00:00:00 2001 From: Stepan Blyshchak Date: Tue, 3 Nov 2020 13:45:50 +0200 Subject: [PATCH 03/44] [dockers] label SONiC Docker with manifest Signed-off-by: Stepan Blyshchak --- dockers/docker-database/Dockerfile.j2 | 4 + dockers/docker-database/manifest.json.j2 | 12 +++ dockers/docker-dhcp-relay/Dockerfile.j2 | 4 + dockers/docker-dhcp-relay/manifest.json.j2 | 13 +++ dockers/docker-fpm-frr/Dockerfile.j2 | 4 + dockers/docker-fpm-frr/manifest.json.j2 | 14 ++++ dockers/docker-fpm-gobgp/Dockerfile.j2 | 5 ++ dockers/docker-fpm-gobgp/manifest.json.j2 | 14 ++++ dockers/docker-fpm-quagga/Dockerfile.j2 | 4 + dockers/docker-fpm-quagga/manifest.json.j2 | 14 ++++ dockers/docker-iccpd/Dockerfile.j2 | 4 + dockers/docker-iccpd/manifest.json.j2 | 13 +++ dockers/docker-lldp/Dockerfile.j2 | 4 + dockers/docker-lldp/manifest.json.j2 | 13 +++ dockers/docker-nat/Dockerfile.j2 | 4 + dockers/docker-nat/manifest.json.j2 | 13 +++ dockers/docker-orchagent/Dockerfile.j2 | 4 + dockers/docker-orchagent/manifest.json.j2 | 13 +++ dockers/docker-platform-monitor/Dockerfile.j2 | 4 + .../docker-platform-monitor/manifest.json.j2 | 13 +++ .../docker-router-advertiser/Dockerfile.j2 | 4 + .../docker-router-advertiser/manifest.json.j2 | 13 +++ dockers/docker-sflow/Dockerfile.j2 | 4 + dockers/docker-sflow/manifest.json.j2 | 13 +++ dockers/docker-snmp/Dockerfile.j2 | 4 + dockers/docker-snmp/manifest.json.j2 | 13 +++ .../docker-sonic-mgmt-framework/Dockerfile.j2 | 4 + .../manifest.json.j2 | 13 +++ dockers/docker-sonic-restapi/Dockerfile.j2 | 4 + dockers/docker-sonic-restapi/manifest.json.j2 | 13 +++ dockers/docker-sonic-sdk/Dockerfile.j2 | 79 +++++++++++++++++++ dockers/docker-sonic-telemetry/Dockerfile.j2 | 4 + .../docker-sonic-telemetry/manifest.json.j2 | 13 +++ dockers/docker-teamd/Dockerfile.j2 | 4 + dockers/docker-teamd/manifest.json.j2 | 13 +++ files/build_templates/packages.json.j2 | 17 ++++ .../build_templates/sonic_debian_extension.j2 | 8 +- platform/barefoot/docker-syncd-bfn-rpc.mk | 1 + platform/barefoot/docker-syncd-bfn.mk | 1 + .../barefoot/docker-syncd-bfn/Dockerfile.j2 | 5 ++ .../docker-syncd-bfn/manifest.json.j2 | 1 + platform/broadcom/docker-syncd-brcm-rpc.mk | 1 + platform/broadcom/docker-syncd-brcm.mk | 1 + .../broadcom/docker-syncd-brcm/Dockerfile.j2 | 4 + .../docker-syncd-brcm/manifest.json.j2 | 1 + platform/cavium/docker-syncd-cavm-rpc.mk | 1 + platform/cavium/docker-syncd-cavm.mk | 1 + .../cavium/docker-syncd-cavm/Dockerfile.j2 | 4 + .../cavium/docker-syncd-cavm/manifest.json.j2 | 1 + .../centec-arm64/docker-syncd-centec-rpc.mk | 1 + platform/centec-arm64/docker-syncd-centec.mk | 1 + .../docker-syncd-centec/Dockerfile.j2 | 4 + .../docker-syncd-centec/manifest.json.j2 | 1 + platform/centec/docker-syncd-centec-rpc.mk | 1 + platform/centec/docker-syncd-centec.mk | 1 + .../centec/docker-syncd-centec/Dockerfile.j2 | 4 + .../docker-syncd-centec/manifest.json.j2 | 1 + platform/innovium/docker-syncd-invm-rpc.mk | 1 + platform/innovium/docker-syncd-invm.mk | 1 + .../innovium/docker-syncd-invm/Dockerfile.j2 | 4 + .../docker-syncd-invm/manifest.json.j2 | 1 + .../marvell-arm64/docker-syncd-mrvl-rpc.mk | 1 + platform/marvell-arm64/docker-syncd-mrvl.mk | 1 + .../docker-syncd-mrvl/Dockerfile.j2 | 4 + .../docker-syncd-mrvl/manifest.json.j2 | 1 + .../marvell-armhf/docker-syncd-mrvl-rpc.mk | 1 + platform/marvell-armhf/docker-syncd-mrvl.mk | 1 + .../docker-syncd-mrvl/Dockerfile.j2 | 4 + .../docker-syncd-mrvl/manifest.json.j2 | 1 + platform/marvell/docker-syncd-mrvl-rpc.mk | 1 + platform/marvell/docker-syncd-mrvl.mk | 1 + .../marvell/docker-syncd-mrvl/Dockerfile.j2 | 4 + .../docker-syncd-mrvl/manifest.json.j2 | 1 + platform/mellanox/docker-syncd-mlnx-rpc.mk | 1 + platform/mellanox/docker-syncd-mlnx.mk | 1 + .../mellanox/docker-syncd-mlnx/Dockerfile.j2 | 4 + .../docker-syncd-mlnx/manifest.json.j2 | 1 + platform/nephos/docker-syncd-nephos-rpc.mk | 1 + platform/nephos/docker-syncd-nephos.mk | 1 + .../nephos/docker-syncd-nephos/Dockerfile.j2 | 4 + .../docker-syncd-nephos/manifest.json.j2 | 1 + platform/template/manifest.json.j2 | 13 +++ platform/vs/docker-gbsyncd-vs.mk | 2 + platform/vs/docker-gbsyncd-vs/Dockerfile.j2 | 4 + .../vs/docker-gbsyncd-vs/manifest.json.j2 | 1 + platform/vs/docker-syncd-vs.mk | 1 + platform/vs/docker-syncd-vs/Dockerfile.j2 | 4 + platform/vs/docker-syncd-vs/manifest.json.j2 | 1 + rules/docker-database.mk | 1 + rules/docker-dhcp-relay.mk | 1 + rules/docker-fpm-frr.mk | 1 + rules/docker-fpm-gobgp.mk | 1 + rules/docker-fpm-quagga.mk | 1 + rules/docker-iccpd.mk | 1 + rules/docker-lldp.mk | 1 + rules/docker-nat.mk | 1 + rules/docker-orchagent.mk | 1 + rules/docker-platform-monitor.mk | 1 + rules/docker-restapi.mk | 1 + rules/docker-router-advertiser.mk | 1 + rules/docker-sflow.mk | 1 + rules/docker-snmp.mk | 1 + rules/docker-sonic-mgmt-framework.mk | 1 + rules/docker-teamd.mk | 1 + rules/docker-telemetry.mk | 1 + slave.mk | 11 ++- 106 files changed, 526 insertions(+), 2 deletions(-) create mode 100644 dockers/docker-database/manifest.json.j2 create mode 100644 dockers/docker-dhcp-relay/manifest.json.j2 create mode 100644 dockers/docker-fpm-frr/manifest.json.j2 create mode 100644 dockers/docker-fpm-gobgp/manifest.json.j2 create mode 100644 dockers/docker-fpm-quagga/manifest.json.j2 create mode 100644 dockers/docker-iccpd/manifest.json.j2 create mode 100644 dockers/docker-lldp/manifest.json.j2 create mode 100644 dockers/docker-nat/manifest.json.j2 create mode 100644 dockers/docker-orchagent/manifest.json.j2 create mode 100644 dockers/docker-platform-monitor/manifest.json.j2 create mode 100644 dockers/docker-router-advertiser/manifest.json.j2 create mode 100644 dockers/docker-sflow/manifest.json.j2 create mode 100644 dockers/docker-snmp/manifest.json.j2 create mode 100644 dockers/docker-sonic-mgmt-framework/manifest.json.j2 create mode 100644 dockers/docker-sonic-restapi/manifest.json.j2 create mode 100644 dockers/docker-sonic-sdk/Dockerfile.j2 create mode 100644 dockers/docker-sonic-telemetry/manifest.json.j2 create mode 100644 dockers/docker-teamd/manifest.json.j2 create mode 100644 files/build_templates/packages.json.j2 create mode 120000 platform/barefoot/docker-syncd-bfn/manifest.json.j2 create mode 120000 platform/broadcom/docker-syncd-brcm/manifest.json.j2 create mode 120000 platform/cavium/docker-syncd-cavm/manifest.json.j2 create mode 120000 platform/centec-arm64/docker-syncd-centec/manifest.json.j2 create mode 120000 platform/centec/docker-syncd-centec/manifest.json.j2 create mode 120000 platform/innovium/docker-syncd-invm/manifest.json.j2 create mode 120000 platform/marvell-arm64/docker-syncd-mrvl/manifest.json.j2 create mode 120000 platform/marvell-armhf/docker-syncd-mrvl/manifest.json.j2 create mode 120000 platform/marvell/docker-syncd-mrvl/manifest.json.j2 create mode 120000 platform/mellanox/docker-syncd-mlnx/manifest.json.j2 create mode 120000 platform/nephos/docker-syncd-nephos/manifest.json.j2 create mode 100644 platform/template/manifest.json.j2 create mode 120000 platform/vs/docker-gbsyncd-vs/manifest.json.j2 create mode 120000 platform/vs/docker-syncd-vs/manifest.json.j2 diff --git a/dockers/docker-database/Dockerfile.j2 b/dockers/docker-database/Dockerfile.j2 index 84f485e4fe83..e4121c8d1981 100644 --- a/dockers/docker-database/Dockerfile.j2 +++ b/dockers/docker-database/Dockerfile.j2 @@ -2,6 +2,8 @@ FROM docker-config-engine-buster ARG docker_container_name +ARG manifest + RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf # Make apt-get non-interactive @@ -59,4 +61,6 @@ COPY ["files/sysctl-net.conf", "/etc/sysctl.d/"] COPY ["critical_processes", "/etc/supervisor"] COPY ["files/update_chassisdb_config", "/usr/local/bin/"] +LABEL com.azure.sonic.manifest="$manifest" + ENTRYPOINT ["/usr/local/bin/docker-database-init.sh"] diff --git a/dockers/docker-database/manifest.json.j2 b/dockers/docker-database/manifest.json.j2 new file mode 100644 index 000000000000..07d43898ff12 --- /dev/null +++ b/dockers/docker-database/manifest.json.j2 @@ -0,0 +1,12 @@ +{ + "version": "1.0.0", + "package": { + "version": "{{ version }}", + "base-os-contraint": "^1.0.0" + }, + "service": { + "name": "{{ name }}", + "asic-service": true, + "host-service": true + } +} diff --git a/dockers/docker-dhcp-relay/Dockerfile.j2 b/dockers/docker-dhcp-relay/Dockerfile.j2 index 58796ca79e25..b7b9a89bbdb6 100644 --- a/dockers/docker-dhcp-relay/Dockerfile.j2 +++ b/dockers/docker-dhcp-relay/Dockerfile.j2 @@ -2,6 +2,8 @@ FROM docker-config-engine-buster ARG docker_container_name +ARG manifest + RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf # Make apt-get non-interactive @@ -29,4 +31,6 @@ COPY ["docker-dhcp-relay.supervisord.conf.j2", "port-name-alias-map.txt.j2", "wa COPY ["files/supervisor-proc-exit-listener", "/usr/bin"] COPY ["critical_processes", "/etc/supervisor"] +LABEL com.azure.sonic.manifest="$manifest" + ENTRYPOINT ["/usr/bin/docker_init.sh"] diff --git a/dockers/docker-dhcp-relay/manifest.json.j2 b/dockers/docker-dhcp-relay/manifest.json.j2 new file mode 100644 index 000000000000..a76b30f9f0ab --- /dev/null +++ b/dockers/docker-dhcp-relay/manifest.json.j2 @@ -0,0 +1,13 @@ +{ + "version": "1.0.0", + "package": { + "version": "{{ version }}", + "base-os-contraint": "^1.0.0", + "depends": ["database^1.0.0", "swss^1.0.0"] + }, + "service": { + "name": "{{ name }}", + "asic-service": false, + "host-service": true + } +} diff --git a/dockers/docker-fpm-frr/Dockerfile.j2 b/dockers/docker-fpm-frr/Dockerfile.j2 index ab8b585899f9..afe557831920 100644 --- a/dockers/docker-fpm-frr/Dockerfile.j2 +++ b/dockers/docker-fpm-frr/Dockerfile.j2 @@ -2,6 +2,8 @@ FROM docker-config-engine-buster ARG docker_container_name +ARG manifest + ARG frr_user_uid ARG frr_user_gid @@ -59,4 +61,6 @@ RUN chmod a+x /usr/bin/TSA && \ chmod a+x /usr/bin/TSB && \ chmod a+x /usr/bin/TSC +LABEL com.azure.sonic.manifest="$manifest" + ENTRYPOINT ["/usr/bin/docker_init.sh"] diff --git a/dockers/docker-fpm-frr/manifest.json.j2 b/dockers/docker-fpm-frr/manifest.json.j2 new file mode 100644 index 000000000000..1daeb738c784 --- /dev/null +++ b/dockers/docker-fpm-frr/manifest.json.j2 @@ -0,0 +1,14 @@ +{ + "version": "1.0.0", + "package": { + "version": "{{ version }}", + "base-os-contraint": "^1.0.0", + "depends": ["database^1.0.0", "swss^1.0.0"], + "conflicts": ["fpm-gobgp", "fpm-quagga"] + }, + "service": { + "name": "{{ name }}", + "asic-service": true, + "host-service": false + } +} diff --git a/dockers/docker-fpm-gobgp/Dockerfile.j2 b/dockers/docker-fpm-gobgp/Dockerfile.j2 index 65b104e43b26..9c8569450fa2 100644 --- a/dockers/docker-fpm-gobgp/Dockerfile.j2 +++ b/dockers/docker-fpm-gobgp/Dockerfile.j2 @@ -1,5 +1,8 @@ FROM docker-fpm-quagga +ARG docker_container_name +ARG manifest + ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive @@ -27,4 +30,6 @@ COPY ["daemons", "/etc/quagga/"] COPY ["files/supervisor-proc-exit-listener", "/usr/bin"] COPY ["critical_processes", "/etc/supervisor"] +LABEL com.azure.sonic.manifest="$manifest" + ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/dockers/docker-fpm-gobgp/manifest.json.j2 b/dockers/docker-fpm-gobgp/manifest.json.j2 new file mode 100644 index 000000000000..9b8a5a11870f --- /dev/null +++ b/dockers/docker-fpm-gobgp/manifest.json.j2 @@ -0,0 +1,14 @@ +{ + "version": "1.0.0", + "package": { + "version": "{{ version }}", + "base-os-contraint": "^1.0.0", + "depends": ["database^1.0.0", "swss^1.0.0"], + "conflicts": ["fpm-frr", "fpm-quagga"] + }, + "service": { + "name": "{{ name }}", + "asic-service": true, + "host-service": false + } +} diff --git a/dockers/docker-fpm-quagga/Dockerfile.j2 b/dockers/docker-fpm-quagga/Dockerfile.j2 index ac382afbe5b2..5b9aabcb411d 100644 --- a/dockers/docker-fpm-quagga/Dockerfile.j2 +++ b/dockers/docker-fpm-quagga/Dockerfile.j2 @@ -1,6 +1,8 @@ FROM docker-config-engine ARG docker_container_name +ARG manifest + RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf # Make apt-get non-interactive @@ -36,4 +38,6 @@ COPY ["*.j2", "/usr/share/sonic/templates/"] COPY ["files/supervisor-proc-exit-listener", "/usr/bin"] COPY ["critical_processes", "/etc/supervisor"] +LABEL com.azure.sonic.manifest="$manifest" + ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/dockers/docker-fpm-quagga/manifest.json.j2 b/dockers/docker-fpm-quagga/manifest.json.j2 new file mode 100644 index 000000000000..cd5734259e46 --- /dev/null +++ b/dockers/docker-fpm-quagga/manifest.json.j2 @@ -0,0 +1,14 @@ +{ + "version": "1.0.0", + "package": { + "version": "{{ version }}", + "base-os-contraint": "^1.0.0", + "depends": ["database^1.0.0", "swss^1.0.0"], + "conflicts": ["fpm-gobgp", "fpm-frr"] + }, + "service": { + "name": "{{ name }}", + "asic-service": true, + "host-service": false + } +} diff --git a/dockers/docker-iccpd/Dockerfile.j2 b/dockers/docker-iccpd/Dockerfile.j2 index 51cc306bdd55..0a42ee0d0a0d 100644 --- a/dockers/docker-iccpd/Dockerfile.j2 +++ b/dockers/docker-iccpd/Dockerfile.j2 @@ -2,6 +2,8 @@ FROM docker-config-engine-buster ARG docker_container_name +ARG manifest + RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf ## Make apt-get non-interactive @@ -31,4 +33,6 @@ RUN apt-get clean -y && \ apt-get autoremove -y && \ rm -rf /debs +LABEL com.azure.sonic.manifest="$manifest" + ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/dockers/docker-iccpd/manifest.json.j2 b/dockers/docker-iccpd/manifest.json.j2 new file mode 100644 index 000000000000..a76b30f9f0ab --- /dev/null +++ b/dockers/docker-iccpd/manifest.json.j2 @@ -0,0 +1,13 @@ +{ + "version": "1.0.0", + "package": { + "version": "{{ version }}", + "base-os-contraint": "^1.0.0", + "depends": ["database^1.0.0", "swss^1.0.0"] + }, + "service": { + "name": "{{ name }}", + "asic-service": false, + "host-service": true + } +} diff --git a/dockers/docker-lldp/Dockerfile.j2 b/dockers/docker-lldp/Dockerfile.j2 index 1306582b0aad..a066dc4c68de 100644 --- a/dockers/docker-lldp/Dockerfile.j2 +++ b/dockers/docker-lldp/Dockerfile.j2 @@ -2,6 +2,8 @@ FROM docker-config-engine-buster ARG docker_container_name +ARG manifest + RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf # Make apt-get non-interactive @@ -44,4 +46,6 @@ COPY ["lldpmgrd", "/usr/bin/"] COPY ["files/supervisor-proc-exit-listener", "/usr/bin"] COPY ["critical_processes", "/etc/supervisor"] +LABEL com.azure.sonic.manifest="$manifest" + ENTRYPOINT ["/usr/bin/docker-lldp-init.sh"] diff --git a/dockers/docker-lldp/manifest.json.j2 b/dockers/docker-lldp/manifest.json.j2 new file mode 100644 index 000000000000..d86a71f9f781 --- /dev/null +++ b/dockers/docker-lldp/manifest.json.j2 @@ -0,0 +1,13 @@ +{ + "version": "1.0.0", + "package": { + "version": "{{ version }}", + "base-os-contraint": "^1.0.0", + "depends": ["database^1.0.0", "swss^1.0.0"] + }, + "service": { + "name": "{{ name }}", + "asic-service": true, + "host-service": true + } +} diff --git a/dockers/docker-nat/Dockerfile.j2 b/dockers/docker-nat/Dockerfile.j2 index 36a178a68af2..6281ffec2749 100644 --- a/dockers/docker-nat/Dockerfile.j2 +++ b/dockers/docker-nat/Dockerfile.j2 @@ -2,6 +2,8 @@ FROM docker-config-engine-buster ARG docker_container_name +ARG manifest + RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf RUN echo @@ -35,4 +37,6 @@ COPY ["critical_processes", "/etc/supervisor"] RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs +LABEL com.azure.sonic.manifest="$manifest" + ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/dockers/docker-nat/manifest.json.j2 b/dockers/docker-nat/manifest.json.j2 new file mode 100644 index 000000000000..a76b30f9f0ab --- /dev/null +++ b/dockers/docker-nat/manifest.json.j2 @@ -0,0 +1,13 @@ +{ + "version": "1.0.0", + "package": { + "version": "{{ version }}", + "base-os-contraint": "^1.0.0", + "depends": ["database^1.0.0", "swss^1.0.0"] + }, + "service": { + "name": "{{ name }}", + "asic-service": false, + "host-service": true + } +} diff --git a/dockers/docker-orchagent/Dockerfile.j2 b/dockers/docker-orchagent/Dockerfile.j2 index b046afedbe7d..a84b50cb2356 100755 --- a/dockers/docker-orchagent/Dockerfile.j2 +++ b/dockers/docker-orchagent/Dockerfile.j2 @@ -2,6 +2,8 @@ FROM docker-config-engine-buster ARG docker_container_name +ARG manifest + RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf # Make apt-get non-interactive @@ -79,4 +81,6 @@ COPY ["critical_processes", "/etc/supervisor/"] # Copy all Jinja2 template files into the templates folder COPY ["*.j2", "/usr/share/sonic/templates/"] +LABEL com.azure.sonic.manifest="$manifest" + ENTRYPOINT ["/usr/bin/docker-init.sh"] diff --git a/dockers/docker-orchagent/manifest.json.j2 b/dockers/docker-orchagent/manifest.json.j2 new file mode 100644 index 000000000000..6f81022833a3 --- /dev/null +++ b/dockers/docker-orchagent/manifest.json.j2 @@ -0,0 +1,13 @@ +{ + "version": "1.0.0", + "package": { + "version": "{{ version }}", + "base-os-contraint": "^1.0.0", + "depends": ["database^1.0.0", "syncd^1.0.0"] + }, + "service": { + "name": "{{ name }}", + "asic-service": true, + "host-service": false + } +} diff --git a/dockers/docker-platform-monitor/Dockerfile.j2 b/dockers/docker-platform-monitor/Dockerfile.j2 index 7659ee4d35be..cedd41540dd6 100755 --- a/dockers/docker-platform-monitor/Dockerfile.j2 +++ b/dockers/docker-platform-monitor/Dockerfile.j2 @@ -2,6 +2,8 @@ FROM docker-config-engine-buster ARG docker_container_name +ARG manifest + RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf # Make apt-get non-interactive @@ -73,4 +75,6 @@ COPY ["ssd_tools/*", "/usr/bin/"] COPY ["files/supervisor-proc-exit-listener", "/usr/bin"] COPY ["critical_processes", "/etc/supervisor"] +LABEL com.azure.sonic.manifest="$manifest" + ENTRYPOINT ["/usr/bin/docker_init.sh"] diff --git a/dockers/docker-platform-monitor/manifest.json.j2 b/dockers/docker-platform-monitor/manifest.json.j2 new file mode 100644 index 000000000000..82f296666838 --- /dev/null +++ b/dockers/docker-platform-monitor/manifest.json.j2 @@ -0,0 +1,13 @@ +{ + "version": "1.0.0", + "package": { + "version": "{{ version }}", + "base-os-contraint": "^1.0.0", + "depends": ["database^1.0.0"] + }, + "service": { + "name": "{{ name }}", + "asic-service": false, + "host-service": true + } +} diff --git a/dockers/docker-router-advertiser/Dockerfile.j2 b/dockers/docker-router-advertiser/Dockerfile.j2 index 38962865567d..b640dab65eac 100644 --- a/dockers/docker-router-advertiser/Dockerfile.j2 +++ b/dockers/docker-router-advertiser/Dockerfile.j2 @@ -2,6 +2,8 @@ FROM docker-config-engine-buster ARG docker_container_name +ARG manifest + RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf # Make apt-get non-interactive @@ -32,4 +34,6 @@ COPY ["radvd.conf.j2", "wait_for_link.sh.j2", "docker-router-advertiser.supervis COPY ["files/supervisor-proc-exit-listener", "/usr/bin"] COPY ["critical_processes", "/etc/supervisor"] +LABEL com.azure.sonic.manifest="$manifest" + ENTRYPOINT ["/usr/bin/docker-init.sh"] diff --git a/dockers/docker-router-advertiser/manifest.json.j2 b/dockers/docker-router-advertiser/manifest.json.j2 new file mode 100644 index 000000000000..a76b30f9f0ab --- /dev/null +++ b/dockers/docker-router-advertiser/manifest.json.j2 @@ -0,0 +1,13 @@ +{ + "version": "1.0.0", + "package": { + "version": "{{ version }}", + "base-os-contraint": "^1.0.0", + "depends": ["database^1.0.0", "swss^1.0.0"] + }, + "service": { + "name": "{{ name }}", + "asic-service": false, + "host-service": true + } +} diff --git a/dockers/docker-sflow/Dockerfile.j2 b/dockers/docker-sflow/Dockerfile.j2 index 476ff3514ace..5181e7db93bf 100644 --- a/dockers/docker-sflow/Dockerfile.j2 +++ b/dockers/docker-sflow/Dockerfile.j2 @@ -2,6 +2,8 @@ FROM docker-config-engine-buster ARG docker_container_name +ARG manifest + RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf ## Make apt-get non-interactive @@ -32,4 +34,6 @@ COPY ["files/supervisor-proc-exit-listener", "/usr/bin"] COPY ["critical_processes", "/etc/supervisor"] COPY ["port_index_mapper.py", "/usr/bin"] +LABEL com.azure.sonic.manifest="$manifest" + ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/dockers/docker-sflow/manifest.json.j2 b/dockers/docker-sflow/manifest.json.j2 new file mode 100644 index 000000000000..a76b30f9f0ab --- /dev/null +++ b/dockers/docker-sflow/manifest.json.j2 @@ -0,0 +1,13 @@ +{ + "version": "1.0.0", + "package": { + "version": "{{ version }}", + "base-os-contraint": "^1.0.0", + "depends": ["database^1.0.0", "swss^1.0.0"] + }, + "service": { + "name": "{{ name }}", + "asic-service": false, + "host-service": true + } +} diff --git a/dockers/docker-snmp/Dockerfile.j2 b/dockers/docker-snmp/Dockerfile.j2 index d479392bb259..7424eaaf08bc 100644 --- a/dockers/docker-snmp/Dockerfile.j2 +++ b/dockers/docker-snmp/Dockerfile.j2 @@ -2,6 +2,8 @@ FROM docker-config-engine-buster ARG docker_container_name +ARG manifest + RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf # Enable -O for all Python calls @@ -76,4 +78,6 @@ COPY ["critical_processes", "/etc/supervisor"] # Although exposing ports is not needed for host net mode, keep it for possible bridge mode EXPOSE 161/udp 162/udp +LABEL com.azure.sonic.manifest="$manifest" + ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/dockers/docker-snmp/manifest.json.j2 b/dockers/docker-snmp/manifest.json.j2 new file mode 100644 index 000000000000..a76b30f9f0ab --- /dev/null +++ b/dockers/docker-snmp/manifest.json.j2 @@ -0,0 +1,13 @@ +{ + "version": "1.0.0", + "package": { + "version": "{{ version }}", + "base-os-contraint": "^1.0.0", + "depends": ["database^1.0.0", "swss^1.0.0"] + }, + "service": { + "name": "{{ name }}", + "asic-service": false, + "host-service": true + } +} diff --git a/dockers/docker-sonic-mgmt-framework/Dockerfile.j2 b/dockers/docker-sonic-mgmt-framework/Dockerfile.j2 index 29f1c05cd26a..676214d60a46 100644 --- a/dockers/docker-sonic-mgmt-framework/Dockerfile.j2 +++ b/dockers/docker-sonic-mgmt-framework/Dockerfile.j2 @@ -1,6 +1,8 @@ FROM docker-config-engine-buster ARG docker_container_name +ARG manifest + RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf ## Make apt-get non-interactive @@ -36,4 +38,6 @@ RUN apt-get remove -y g++ python-dev RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs +LABEL com.azure.sonic.manifest="$manifest" + ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/dockers/docker-sonic-mgmt-framework/manifest.json.j2 b/dockers/docker-sonic-mgmt-framework/manifest.json.j2 new file mode 100644 index 000000000000..a76b30f9f0ab --- /dev/null +++ b/dockers/docker-sonic-mgmt-framework/manifest.json.j2 @@ -0,0 +1,13 @@ +{ + "version": "1.0.0", + "package": { + "version": "{{ version }}", + "base-os-contraint": "^1.0.0", + "depends": ["database^1.0.0", "swss^1.0.0"] + }, + "service": { + "name": "{{ name }}", + "asic-service": false, + "host-service": true + } +} diff --git a/dockers/docker-sonic-restapi/Dockerfile.j2 b/dockers/docker-sonic-restapi/Dockerfile.j2 index 837796e66d82..b3b5542dff3b 100644 --- a/dockers/docker-sonic-restapi/Dockerfile.j2 +++ b/dockers/docker-sonic-restapi/Dockerfile.j2 @@ -2,6 +2,8 @@ FROM docker-config-engine-stretch ARG docker_container_name +ARG manifest + RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf ## Make apt-get non-interactive @@ -25,4 +27,6 @@ COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] COPY ["files/supervisor-proc-exit-listener", "/usr/bin"] COPY ["critical_processes", "/etc/supervisor"] +LABEL com.azure.sonic.manifest="$manifest" + ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/dockers/docker-sonic-restapi/manifest.json.j2 b/dockers/docker-sonic-restapi/manifest.json.j2 new file mode 100644 index 000000000000..a76b30f9f0ab --- /dev/null +++ b/dockers/docker-sonic-restapi/manifest.json.j2 @@ -0,0 +1,13 @@ +{ + "version": "1.0.0", + "package": { + "version": "{{ version }}", + "base-os-contraint": "^1.0.0", + "depends": ["database^1.0.0", "swss^1.0.0"] + }, + "service": { + "name": "{{ name }}", + "asic-service": false, + "host-service": true + } +} diff --git a/dockers/docker-sonic-sdk/Dockerfile.j2 b/dockers/docker-sonic-sdk/Dockerfile.j2 new file mode 100644 index 000000000000..b74aec7f1973 --- /dev/null +++ b/dockers/docker-sonic-sdk/Dockerfile.j2 @@ -0,0 +1,79 @@ +{% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} +FROM docker-config-engine-buster + +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update && \ + apt-get install -f -y \ + ifupdown \ + arping \ + libdbus-1-3 \ + libdaemon0 \ + libjansson4 \ + libpython2.7 \ + iproute2 \ + ndisc6 \ + tcpdump \ + libatomic1 \ + libjemalloc1 \ + liblua5.1-0 \ + lua-bitop \ + lua-cjson \ + libelf1 \ + libmnl0 \ + bridge-utils + + +## Build tools +RUN apt-get update && \ + apt-get install -f -y \ + autoconf \ + automake \ + libtool \ + curl \ + make \ + g++ \ + gcc \ + vim \ + git \ + unzip + +{% if ( CONFIGURED_ARCH == "armhf" or CONFIGURED_ARCH == "arm64" ) %} +## Fix for gcc/python not found in arm docker +RUN apt-get install -f -y python2.7 python2.7-dev +RUN apt-get install -y gcc-6 +{% endif %} +{% if CONFIGURED_ARCH == "armhf" %} +RUN ln -s -f /usr/bin/gcc-6 /usr/bin/arm-linux-gnueabihf-gcc +{% endif %} +{% if CONFIGURED_ARCH == "arm64" %} +RUN ln -s -f /usr/bin/gcc-6 /usr/bin/aarch64-linux-gnu-gcc +{% endif %} + +#RUN pip install \ +# scapy==2.4.2 \ +# setuptools \ +# pyroute2==0.5.3 +#RUN pip install \ +# netifaces==0.10.7 \ +# monotonic==1.5 + +{% if ( CONFIGURED_ARCH == "armhf" or CONFIGURED_ARCH == "arm64" ) %} +# Remove installed gcc +RUN apt-get remove -y gcc-6 +{% endif %} + +{% if docker_sonic_sdk_debs.strip() -%} +# Copy locally-built Debian package dependencies +{{ copy_files("debs/", docker_sonic_sdk_debs.split(' '), "/debs/") }} + +# Install locally-built Debian packages and implicitly install their dependencies +{{ install_debian_packages(docker_sonic_sdk_debs.split(' ')) }} +{%- endif %} + +## Clean up +RUN apt-get clean -y && \ + apt-get autoclean -y && \ + apt-get autoremove -y && \ + rm -rf /debs diff --git a/dockers/docker-sonic-telemetry/Dockerfile.j2 b/dockers/docker-sonic-telemetry/Dockerfile.j2 index 65e436d293d7..92c8da954e6f 100644 --- a/dockers/docker-sonic-telemetry/Dockerfile.j2 +++ b/dockers/docker-sonic-telemetry/Dockerfile.j2 @@ -2,6 +2,8 @@ FROM docker-config-engine-buster ARG docker_container_name +ARG manifest + RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf ## Make apt-get non-interactive @@ -28,4 +30,6 @@ COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] COPY ["files/supervisor-proc-exit-listener", "/usr/bin"] COPY ["critical_processes", "/etc/supervisor"] +LABEL com.azure.sonic.manifest="$manifest" + ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/dockers/docker-sonic-telemetry/manifest.json.j2 b/dockers/docker-sonic-telemetry/manifest.json.j2 new file mode 100644 index 000000000000..a76b30f9f0ab --- /dev/null +++ b/dockers/docker-sonic-telemetry/manifest.json.j2 @@ -0,0 +1,13 @@ +{ + "version": "1.0.0", + "package": { + "version": "{{ version }}", + "base-os-contraint": "^1.0.0", + "depends": ["database^1.0.0", "swss^1.0.0"] + }, + "service": { + "name": "{{ name }}", + "asic-service": false, + "host-service": true + } +} diff --git a/dockers/docker-teamd/Dockerfile.j2 b/dockers/docker-teamd/Dockerfile.j2 index 7f4db2936857..29f8cb3955f0 100644 --- a/dockers/docker-teamd/Dockerfile.j2 +++ b/dockers/docker-teamd/Dockerfile.j2 @@ -2,6 +2,8 @@ FROM docker-config-engine-buster ARG docker_container_name +ARG manifest + RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf ## Make apt-get non-interactive @@ -27,4 +29,6 @@ COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] COPY ["files/supervisor-proc-exit-listener", "/usr/bin"] COPY ["critical_processes", "/etc/supervisor"] +LABEL com.azure.sonic.manifest="$manifest" + ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/dockers/docker-teamd/manifest.json.j2 b/dockers/docker-teamd/manifest.json.j2 new file mode 100644 index 000000000000..4766bbde8b26 --- /dev/null +++ b/dockers/docker-teamd/manifest.json.j2 @@ -0,0 +1,13 @@ +{ + "version": "1.0.0", + "package": { + "version": "{{ version }}", + "base-os-contraint": "^1.0.0", + "depends": ["database^1.0.0", "swss^1.0.0"] + }, + "service": { + "name": "{{ name }}", + "asic-service": true, + "host-service": false + } +} diff --git a/files/build_templates/packages.json.j2 b/files/build_templates/packages.json.j2 new file mode 100644 index 000000000000..3c0d1034031a --- /dev/null +++ b/files/build_templates/packages.json.j2 @@ -0,0 +1,17 @@ +{ +{% for docker_installation_target in installer_images.strip().split() -%} +{% set pkgname, docker_build_path, image = docker_installation_target.split('|') -%} +{% set imagefilepath = image.split(':')|first -%} +{% set imageversion = image.split(':')|last -%} +{% set imagefilename = imagefilepath.split('/')|last -%} +{% set imagename = imagefilename.split('.')|first -%} + "{{ pkgname }}": { + "repository": "{{ imagename }}", + "description": "SONiC {{ pkgname }} package", + "default-reference": "{{ imageversion }}", + "installed-version": "{{ imageversion }}", + "built-in": true, + "installed": true + }{% if not loop.last %},{% endif %} +{% endfor %} +} diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 1321ab2d4db3..4716c6f3abf9 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -522,7 +522,9 @@ sudo mount proc /proc -t proc sudo mkdir $FILESYSTEM_ROOT/target sudo mount --bind target $FILESYSTEM_ROOT/target sudo chroot $FILESYSTEM_ROOT docker $SONIC_NATIVE_DOCKERD_FOR_DOCKERFS info -{% for image in installer_images.strip().split(' ') -%} + +{% for docker_installation_target in installer_images.strip().split() -%} +{% set pkgname, docker_build_path, image = docker_installation_target.split('|') %} {% set imagefilepath = image.split(':')|first -%} {% set imageversion = image.split(':')|last -%} {% set imagefilename = imagefilepath.split('/')|last -%} @@ -536,6 +538,10 @@ sudo LANG=C chroot $FILESYSTEM_ROOT docker $SONIC_NATIVE_DOCKERD_FOR_DOCKERFS ta {% endif %} {% endfor %} +SONIC_PACKAGE_MANAGER_FOLDER="/var/lib/sonic-package-manager/" +sudo mkdir -p $FILESYSTEM_ROOT/$SONIC_PACKAGE_MANAGER_FOLDER +j2 $BUILD_TEMPLATES/packages.json.j2 | sudo tee $FILESYSTEM_ROOT/$SONIC_PACKAGE_MANAGER_FOLDER/packages.json + {% if include_kubernetes == "y" %} ## Pull in kubernetes docker images echo "pulling universal k8s images ..." diff --git a/platform/barefoot/docker-syncd-bfn-rpc.mk b/platform/barefoot/docker-syncd-bfn-rpc.mk index 41c55b1bcf7d..98486f2420f7 100644 --- a/platform/barefoot/docker-syncd-bfn-rpc.mk +++ b/platform/barefoot/docker-syncd-bfn-rpc.mk @@ -19,6 +19,7 @@ endif $(DOCKER_SYNCD_BFN_RPC)_CONTAINER_NAME = syncd $(DOCKER_SYNCD_BFN_RPC)_VERSION = 1.0.0 +$(DOCKER_SYNCD_BFN_RPC)_PACKAGE_NAME = syncd $(DOCKER_SYNCD_BFN_RPC)_RUN_OPT += --net=host --privileged -t $(DOCKER_SYNCD_BFN_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf $(DOCKER_SYNCD_BFN_RPC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro diff --git a/platform/barefoot/docker-syncd-bfn.mk b/platform/barefoot/docker-syncd-bfn.mk index d3d018393b47..ffb373978269 100644 --- a/platform/barefoot/docker-syncd-bfn.mk +++ b/platform/barefoot/docker-syncd-bfn.mk @@ -11,6 +11,7 @@ $(DOCKER_SYNCD_BASE)_DBG_DEPENDS += $(SYNCD_DBG) \ $(LIBSAIREDIS_DBG) $(DOCKER_SYNCD_BASE)_VERSION = 1.0.0 +$(DOCKER_SYNCD_BASE)_PACKAGE_NAME = syncd SONIC_STRETCH_DOCKERS += $(DOCKER_SYNCD_BASE) SONIC_STRETCH_DBG_DOCKERS += $(DOCKER_SYNCD_BASE_DBG) diff --git a/platform/barefoot/docker-syncd-bfn/Dockerfile.j2 b/platform/barefoot/docker-syncd-bfn/Dockerfile.j2 index b4bcafe5926a..af70b1a1debe 100755 --- a/platform/barefoot/docker-syncd-bfn/Dockerfile.j2 +++ b/platform/barefoot/docker-syncd-bfn/Dockerfile.j2 @@ -1,5 +1,8 @@ FROM docker-config-engine-stretch +ARG docker_container_name +ARG manifest + ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive @@ -36,4 +39,6 @@ COPY ["critical_processes", "/etc/supervisor/"] RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs +LABEL com.azure.sonic.manifest="$manifest" + ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/platform/barefoot/docker-syncd-bfn/manifest.json.j2 b/platform/barefoot/docker-syncd-bfn/manifest.json.j2 new file mode 120000 index 000000000000..affca28ad9a9 --- /dev/null +++ b/platform/barefoot/docker-syncd-bfn/manifest.json.j2 @@ -0,0 +1 @@ +../../template/manifest.json.j2 \ No newline at end of file diff --git a/platform/broadcom/docker-syncd-brcm-rpc.mk b/platform/broadcom/docker-syncd-brcm-rpc.mk index ca9bfaac54dd..ec54a70bbd4c 100644 --- a/platform/broadcom/docker-syncd-brcm-rpc.mk +++ b/platform/broadcom/docker-syncd-brcm-rpc.mk @@ -19,6 +19,7 @@ endif $(DOCKER_SYNCD_BRCM_RPC)_CONTAINER_NAME = syncd $(DOCKER_SYNCD_BRCM_RPC)_VERSION = 1.0.0 +$(DOCKER_SYNCD_BRCM_RPC)_PACKAGE_NAME = syncd $(DOCKER_SYNCD_BRCM_RPC)_RUN_OPT += --privileged -t $(DOCKER_SYNCD_BRCM_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf $(DOCKER_SYNCD_BRCM_RPC)_RUN_OPT += -v /host/warmboot:/var/warmboot diff --git a/platform/broadcom/docker-syncd-brcm.mk b/platform/broadcom/docker-syncd-brcm.mk index 3b59a99f9131..ad39fa23d0a2 100644 --- a/platform/broadcom/docker-syncd-brcm.mk +++ b/platform/broadcom/docker-syncd-brcm.mk @@ -15,6 +15,7 @@ SONIC_STRETCH_DOCKERS += $(DOCKER_SYNCD_BASE) SONIC_STRETCH_DBG_DOCKERS += $(DOCKER_SYNCD_BASE_DBG) $(DOCKER_SYNCD_BASE)_VERSION = 1.0.0 +$(DOCKER_SYNCD_BASE)_PACKAGE_NAME = syncd $(DOCKER_SYNCD_BASE)_RUN_OPT += -v /host/warmboot:/var/warmboot diff --git a/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 b/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 index 35b3d352a827..81b5d6ccc5a8 100755 --- a/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 +++ b/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 @@ -2,6 +2,8 @@ FROM docker-config-engine-stretch ARG docker_container_name +ARG manifest + RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf ## Make apt-get non-interactive @@ -32,4 +34,6 @@ COPY ["critical_processes", "/etc/supervisor/"] RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs +LABEL com.azure.sonic.manifest="$manifest" + ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/platform/broadcom/docker-syncd-brcm/manifest.json.j2 b/platform/broadcom/docker-syncd-brcm/manifest.json.j2 new file mode 120000 index 000000000000..affca28ad9a9 --- /dev/null +++ b/platform/broadcom/docker-syncd-brcm/manifest.json.j2 @@ -0,0 +1 @@ +../../template/manifest.json.j2 \ No newline at end of file diff --git a/platform/cavium/docker-syncd-cavm-rpc.mk b/platform/cavium/docker-syncd-cavm-rpc.mk index 10a47d31b32b..5112c1b39006 100644 --- a/platform/cavium/docker-syncd-cavm-rpc.mk +++ b/platform/cavium/docker-syncd-cavm-rpc.mk @@ -18,6 +18,7 @@ endif $(DOCKER_SYNCD_CAVM_RPC)_CONTAINER_NAME = syncd $(DOCKER_SYNCD_CAVM_RPC)_VERSION = 1.0.0 +$(DOCKER_SYNCD_CAVM_RPC)_PACKAGE_NAME = syncd $(DOCKER_SYNCD_CAVM_RPC)_RUN_OPT += --net=host --privileged -t $(DOCKER_SYNCD_CAVM_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf $(DOCKER_SYNCD_CAVM_RPC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro diff --git a/platform/cavium/docker-syncd-cavm.mk b/platform/cavium/docker-syncd-cavm.mk index 02b1a6d73f83..18db07686628 100644 --- a/platform/cavium/docker-syncd-cavm.mk +++ b/platform/cavium/docker-syncd-cavm.mk @@ -17,6 +17,7 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_CAVM) endif $(DOCKER_SYNCD_BASE)_VERSION = 1.0.0 +$(DOCKER_SYNCD_BASE)_PACKAGE_NAME = syncd $(DOCKER_SYNCD_CAVM)_CONTAINER_NAME = syncd $(DOCKER_SYNCD_CAVM)_RUN_OPT += --net=host --privileged -t diff --git a/platform/cavium/docker-syncd-cavm/Dockerfile.j2 b/platform/cavium/docker-syncd-cavm/Dockerfile.j2 index fcf82276ad1a..3a93f9acb23f 100755 --- a/platform/cavium/docker-syncd-cavm/Dockerfile.j2 +++ b/platform/cavium/docker-syncd-cavm/Dockerfile.j2 @@ -1,6 +1,8 @@ FROM docker-config-engine ARG docker_container_name +ARG manifest + RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf ## Make apt-get non-interactive @@ -32,4 +34,6 @@ COPY ["profile.ini", "/etc/ssw/AS7512/"] RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs +LABEL com.azure.sonic.manifest="$manifest" + ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/platform/cavium/docker-syncd-cavm/manifest.json.j2 b/platform/cavium/docker-syncd-cavm/manifest.json.j2 new file mode 120000 index 000000000000..affca28ad9a9 --- /dev/null +++ b/platform/cavium/docker-syncd-cavm/manifest.json.j2 @@ -0,0 +1 @@ +../../template/manifest.json.j2 \ No newline at end of file diff --git a/platform/centec-arm64/docker-syncd-centec-rpc.mk b/platform/centec-arm64/docker-syncd-centec-rpc.mk index e66089249622..9d848f7523e7 100755 --- a/platform/centec-arm64/docker-syncd-centec-rpc.mk +++ b/platform/centec-arm64/docker-syncd-centec-rpc.mk @@ -19,6 +19,7 @@ endif $(DOCKER_SYNCD_CENTEC_RPC)_CONTAINER_NAME = syncd $(DOCKER_SYNCD_CENTEC_RPC)_VERSION = 1.0.0 +$(DOCKER_SYNCD_CENTEC_RPC)_PACKAGE_NAME = syncd $(DOCKER_SYNCD_CENTEC_RPC)_RUN_OPT += --privileged -t $(DOCKER_SYNCD_CENTEC_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf $(DOCKER_SYNCD_CENTEC_RPC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro diff --git a/platform/centec-arm64/docker-syncd-centec.mk b/platform/centec-arm64/docker-syncd-centec.mk index e9db642b026e..5e9102912871 100755 --- a/platform/centec-arm64/docker-syncd-centec.mk +++ b/platform/centec-arm64/docker-syncd-centec.mk @@ -14,6 +14,7 @@ SONIC_STRETCH_DOCKERS += $(DOCKER_SYNCD_BASE) SONIC_STRETCH_DBG_DOCKERS += $(DOCKER_SYNCD_BASE_DBG) $(DOCKER_SYNCD_BASE)_VERSION = 1.0.0 +$(DOCKER_SYNCD_BASE)_PACKAGE_NAME = syncd $(DOCKER_SYNCD_BASE)_RUN_OPT += -v /host/warmboot:/var/warmboot $(DOCKER_SYNCD_CENTEC)_RUN_OPT += --privileged -t $(DOCKER_SYNCD_CENTEC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf diff --git a/platform/centec-arm64/docker-syncd-centec/Dockerfile.j2 b/platform/centec-arm64/docker-syncd-centec/Dockerfile.j2 index 7590d65600b7..95ae5ddeccb9 100755 --- a/platform/centec-arm64/docker-syncd-centec/Dockerfile.j2 +++ b/platform/centec-arm64/docker-syncd-centec/Dockerfile.j2 @@ -1,6 +1,8 @@ FROM docker-config-engine-stretch ARG docker_container_name +ARG manifest + RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf ## Make apt-get non-interactive @@ -34,4 +36,6 @@ COPY ["critical_processes", "/etc/supervisor/"] RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs +LABEL com.azure.sonic.manifest="$manifest" + ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/platform/centec-arm64/docker-syncd-centec/manifest.json.j2 b/platform/centec-arm64/docker-syncd-centec/manifest.json.j2 new file mode 120000 index 000000000000..affca28ad9a9 --- /dev/null +++ b/platform/centec-arm64/docker-syncd-centec/manifest.json.j2 @@ -0,0 +1 @@ +../../template/manifest.json.j2 \ No newline at end of file diff --git a/platform/centec/docker-syncd-centec-rpc.mk b/platform/centec/docker-syncd-centec-rpc.mk index b5b98e7bee4e..2f14024d8c10 100644 --- a/platform/centec/docker-syncd-centec-rpc.mk +++ b/platform/centec/docker-syncd-centec-rpc.mk @@ -19,6 +19,7 @@ endif $(DOCKER_SYNCD_CENTEC_RPC)_CONTAINER_NAME = syncd $(DOCKER_SYNCD_CENTEC_RPC)_VERSION = 1.0.0 +$(DOCKER_SYNCD_CENTEC_RPC)_PACKAGE_NAME = syncd $(DOCKER_SYNCD_CENTEC_RPC)_RUN_OPT += --privileged -t $(DOCKER_SYNCD_CENTEC_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf $(DOCKER_SYNCD_CENTEC_RPC)_RUN_OPT += -v /var/run/docker-syncd:/var/run/sswsyncd diff --git a/platform/centec/docker-syncd-centec.mk b/platform/centec/docker-syncd-centec.mk index d5d819f2235a..b8c46a3033f0 100644 --- a/platform/centec/docker-syncd-centec.mk +++ b/platform/centec/docker-syncd-centec.mk @@ -14,6 +14,7 @@ SONIC_STRETCH_DOCKERS += $(DOCKER_SYNCD_BASE) SONIC_STRETCH_DBG_DOCKERS += $(DOCKER_SYNCD_BASE_DBG) $(DOCKER_SYNCD_BASE)_VERSION = 1.0.0 +$(DOCKER_SYNCD_BASE)_PACKAGE_NAME = syncd $(DOCKER_SYNCD_CENTEC)_RUN_OPT += --privileged -t $(DOCKER_SYNCD_CENTEC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf diff --git a/platform/centec/docker-syncd-centec/Dockerfile.j2 b/platform/centec/docker-syncd-centec/Dockerfile.j2 index 8bb5041b15ba..a391fa3f5d47 100755 --- a/platform/centec/docker-syncd-centec/Dockerfile.j2 +++ b/platform/centec/docker-syncd-centec/Dockerfile.j2 @@ -1,6 +1,8 @@ FROM docker-config-engine-stretch ARG docker_container_name +ARG manifest + RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf ## Make apt-get non-interactive @@ -30,4 +32,6 @@ COPY ["critical_processes", "/etc/supervisor/"] RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs +LABEL com.azure.sonic.manifest="$manifest" + ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/platform/centec/docker-syncd-centec/manifest.json.j2 b/platform/centec/docker-syncd-centec/manifest.json.j2 new file mode 120000 index 000000000000..affca28ad9a9 --- /dev/null +++ b/platform/centec/docker-syncd-centec/manifest.json.j2 @@ -0,0 +1 @@ +../../template/manifest.json.j2 \ No newline at end of file diff --git a/platform/innovium/docker-syncd-invm-rpc.mk b/platform/innovium/docker-syncd-invm-rpc.mk index de4cce280c70..65e1febf99a2 100755 --- a/platform/innovium/docker-syncd-invm-rpc.mk +++ b/platform/innovium/docker-syncd-invm-rpc.mk @@ -11,6 +11,7 @@ endif $(DOCKER_SYNCD_INVM_RPC)_CONTAINER_NAME = syncd $(DOCKER_SYNCD_INVM_RPC)_VERSION = 1.0.0 +$(DOCKER_SYNCD_INVM_RPC)_PACKAGE_NAME = syncd $(DOCKER_SYNCD_INVM_RPC)_RUN_OPT += --net=host --privileged -t $(DOCKER_SYNCD_INVM_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf $(DOCKER_SYNCD_INVM_RPC)_RUN_OPT += -v /var/run/docker-syncd:/var/run/sswsyncd diff --git a/platform/innovium/docker-syncd-invm.mk b/platform/innovium/docker-syncd-invm.mk index 75d0a1d4933b..f500515c56e3 100755 --- a/platform/innovium/docker-syncd-invm.mk +++ b/platform/innovium/docker-syncd-invm.mk @@ -14,5 +14,6 @@ SONIC_STRETCH_DOCKERS += $(DOCKER_SYNCD_BASE) SONIC_STRETCH_DBG_DOCKERS += $(DOCKER_SYNCD_BASE_DBG) $(DOCKER_SYNCD_BASE)_VERSION = 1.0.0 +$(DOCKER_SYNCD_BASE)_PACKAGE_NAME = syncd $(DOCKER_SYNCD_BASE)_RUN_OPT += -v /host/warmboot:/var/warmboot diff --git a/platform/innovium/docker-syncd-invm/Dockerfile.j2 b/platform/innovium/docker-syncd-invm/Dockerfile.j2 index ab4be823de66..3f1a82f28204 100755 --- a/platform/innovium/docker-syncd-invm/Dockerfile.j2 +++ b/platform/innovium/docker-syncd-invm/Dockerfile.j2 @@ -1,6 +1,8 @@ FROM docker-config-engine-stretch ARG docker_container_name +ARG manifest + RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf ## Make apt-get non-interactive @@ -30,4 +32,6 @@ COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs +LABEL com.azure.sonic.manifest="$manifest" + ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/platform/innovium/docker-syncd-invm/manifest.json.j2 b/platform/innovium/docker-syncd-invm/manifest.json.j2 new file mode 120000 index 000000000000..affca28ad9a9 --- /dev/null +++ b/platform/innovium/docker-syncd-invm/manifest.json.j2 @@ -0,0 +1 @@ +../../template/manifest.json.j2 \ No newline at end of file diff --git a/platform/marvell-arm64/docker-syncd-mrvl-rpc.mk b/platform/marvell-arm64/docker-syncd-mrvl-rpc.mk index 4d5b445cfbf7..c63c59006e93 100644 --- a/platform/marvell-arm64/docker-syncd-mrvl-rpc.mk +++ b/platform/marvell-arm64/docker-syncd-mrvl-rpc.mk @@ -19,6 +19,7 @@ endif $(DOCKER_SYNCD_MRVL_RPC)_CONTAINER_NAME = syncd $(DOCKER_SYNCD_MRVL_RPC)_VERSION = 1.0.0 +$(DOCKER_SYNCD_MRVL_RPC)_PACKAGE_NAME = syncd $(DOCKER_SYNCD_MRVL_RPC)_RUN_OPT += --net=host --privileged -t $(DOCKER_SYNCD_MRVL_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf $(DOCKER_SYNCD_MRVL_RPC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro diff --git a/platform/marvell-arm64/docker-syncd-mrvl.mk b/platform/marvell-arm64/docker-syncd-mrvl.mk index 2b8fc7f9d2ca..f35ce7fa36b5 100644 --- a/platform/marvell-arm64/docker-syncd-mrvl.mk +++ b/platform/marvell-arm64/docker-syncd-mrvl.mk @@ -14,6 +14,7 @@ SONIC_STRETCH_DOCKERS += $(DOCKER_SYNCD_BASE) SONIC_STRETCH_DBG_DOCKERS += $(DOCKER_SYNCD_BASE_DBG) $(DOCKER_SYNCD_BASE)_VERSION = 1.0.0 +$(DOCKER_SYNCD_BASE)_PACKAGE_NAME = syncd $(DOCKER_SYNCD_BASE)_RUN_OPT += -v /host/warmboot:/var/warmboot $(DOCKER_SYNCD_BASE)_BASE_IMAGE_FILES += monit_syncd:/etc/monit/conf.d diff --git a/platform/marvell-arm64/docker-syncd-mrvl/Dockerfile.j2 b/platform/marvell-arm64/docker-syncd-mrvl/Dockerfile.j2 index afaac3fd056c..a7b68a729a2a 100755 --- a/platform/marvell-arm64/docker-syncd-mrvl/Dockerfile.j2 +++ b/platform/marvell-arm64/docker-syncd-mrvl/Dockerfile.j2 @@ -1,6 +1,8 @@ FROM docker-config-engine-stretch ARG docker_container_name +ARG manifest + RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf ## Make apt-get non-interactive @@ -34,4 +36,6 @@ COPY ["critical_processes", "/etc/supervisor/"] RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs +LABEL com.azure.sonic.manifest="$manifest" + ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/platform/marvell-arm64/docker-syncd-mrvl/manifest.json.j2 b/platform/marvell-arm64/docker-syncd-mrvl/manifest.json.j2 new file mode 120000 index 000000000000..affca28ad9a9 --- /dev/null +++ b/platform/marvell-arm64/docker-syncd-mrvl/manifest.json.j2 @@ -0,0 +1 @@ +../../template/manifest.json.j2 \ No newline at end of file diff --git a/platform/marvell-armhf/docker-syncd-mrvl-rpc.mk b/platform/marvell-armhf/docker-syncd-mrvl-rpc.mk index 4d5b445cfbf7..c63c59006e93 100644 --- a/platform/marvell-armhf/docker-syncd-mrvl-rpc.mk +++ b/platform/marvell-armhf/docker-syncd-mrvl-rpc.mk @@ -19,6 +19,7 @@ endif $(DOCKER_SYNCD_MRVL_RPC)_CONTAINER_NAME = syncd $(DOCKER_SYNCD_MRVL_RPC)_VERSION = 1.0.0 +$(DOCKER_SYNCD_MRVL_RPC)_PACKAGE_NAME = syncd $(DOCKER_SYNCD_MRVL_RPC)_RUN_OPT += --net=host --privileged -t $(DOCKER_SYNCD_MRVL_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf $(DOCKER_SYNCD_MRVL_RPC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro diff --git a/platform/marvell-armhf/docker-syncd-mrvl.mk b/platform/marvell-armhf/docker-syncd-mrvl.mk index 2b8fc7f9d2ca..f35ce7fa36b5 100644 --- a/platform/marvell-armhf/docker-syncd-mrvl.mk +++ b/platform/marvell-armhf/docker-syncd-mrvl.mk @@ -14,6 +14,7 @@ SONIC_STRETCH_DOCKERS += $(DOCKER_SYNCD_BASE) SONIC_STRETCH_DBG_DOCKERS += $(DOCKER_SYNCD_BASE_DBG) $(DOCKER_SYNCD_BASE)_VERSION = 1.0.0 +$(DOCKER_SYNCD_BASE)_PACKAGE_NAME = syncd $(DOCKER_SYNCD_BASE)_RUN_OPT += -v /host/warmboot:/var/warmboot $(DOCKER_SYNCD_BASE)_BASE_IMAGE_FILES += monit_syncd:/etc/monit/conf.d diff --git a/platform/marvell-armhf/docker-syncd-mrvl/Dockerfile.j2 b/platform/marvell-armhf/docker-syncd-mrvl/Dockerfile.j2 index afaac3fd056c..a7b68a729a2a 100755 --- a/platform/marvell-armhf/docker-syncd-mrvl/Dockerfile.j2 +++ b/platform/marvell-armhf/docker-syncd-mrvl/Dockerfile.j2 @@ -1,6 +1,8 @@ FROM docker-config-engine-stretch ARG docker_container_name +ARG manifest + RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf ## Make apt-get non-interactive @@ -34,4 +36,6 @@ COPY ["critical_processes", "/etc/supervisor/"] RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs +LABEL com.azure.sonic.manifest="$manifest" + ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/platform/marvell-armhf/docker-syncd-mrvl/manifest.json.j2 b/platform/marvell-armhf/docker-syncd-mrvl/manifest.json.j2 new file mode 120000 index 000000000000..affca28ad9a9 --- /dev/null +++ b/platform/marvell-armhf/docker-syncd-mrvl/manifest.json.j2 @@ -0,0 +1 @@ +../../template/manifest.json.j2 \ No newline at end of file diff --git a/platform/marvell/docker-syncd-mrvl-rpc.mk b/platform/marvell/docker-syncd-mrvl-rpc.mk index 4d5b445cfbf7..c63c59006e93 100644 --- a/platform/marvell/docker-syncd-mrvl-rpc.mk +++ b/platform/marvell/docker-syncd-mrvl-rpc.mk @@ -19,6 +19,7 @@ endif $(DOCKER_SYNCD_MRVL_RPC)_CONTAINER_NAME = syncd $(DOCKER_SYNCD_MRVL_RPC)_VERSION = 1.0.0 +$(DOCKER_SYNCD_MRVL_RPC)_PACKAGE_NAME = syncd $(DOCKER_SYNCD_MRVL_RPC)_RUN_OPT += --net=host --privileged -t $(DOCKER_SYNCD_MRVL_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf $(DOCKER_SYNCD_MRVL_RPC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro diff --git a/platform/marvell/docker-syncd-mrvl.mk b/platform/marvell/docker-syncd-mrvl.mk index 4cac777bf9e5..d7617aac186e 100644 --- a/platform/marvell/docker-syncd-mrvl.mk +++ b/platform/marvell/docker-syncd-mrvl.mk @@ -14,6 +14,7 @@ SONIC_STRETCH_DOCKERS += $(DOCKER_SYNCD_BASE) SONIC_STRETCH_DBG_DOCKERS += $(DOCKER_SYNCD_BASE_DBG) $(DOCKER_SYNCD_BASE)_VERSION = 1.0.0 +$(DOCKER_SYNCD_BASE)_PACKAGE_NAME = syncd $(DOCKER_SYNCD_BASE)_RUN_OPT += -v /host/warmboot:/var/warmboot $(DOCKER_SYNCD_BASE)_RUN_OPT += -v /var/run/docker-syncd:/var/run/sswsyncd diff --git a/platform/marvell/docker-syncd-mrvl/Dockerfile.j2 b/platform/marvell/docker-syncd-mrvl/Dockerfile.j2 index e91231e49791..f75d47070ce6 100755 --- a/platform/marvell/docker-syncd-mrvl/Dockerfile.j2 +++ b/platform/marvell/docker-syncd-mrvl/Dockerfile.j2 @@ -1,6 +1,8 @@ FROM docker-config-engine-stretch ARG docker_container_name +ARG manifest + RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf ## Make apt-get non-interactive @@ -30,4 +32,6 @@ COPY ["critical_processes", "/etc/supervisor/"] RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs +LABEL com.azure.sonic.manifest="$manifest" + ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/platform/marvell/docker-syncd-mrvl/manifest.json.j2 b/platform/marvell/docker-syncd-mrvl/manifest.json.j2 new file mode 120000 index 000000000000..affca28ad9a9 --- /dev/null +++ b/platform/marvell/docker-syncd-mrvl/manifest.json.j2 @@ -0,0 +1 @@ +../../template/manifest.json.j2 \ No newline at end of file diff --git a/platform/mellanox/docker-syncd-mlnx-rpc.mk b/platform/mellanox/docker-syncd-mlnx-rpc.mk index dcdc79d36b59..52085e06f750 100644 --- a/platform/mellanox/docker-syncd-mlnx-rpc.mk +++ b/platform/mellanox/docker-syncd-mlnx-rpc.mk @@ -21,6 +21,7 @@ endif $(DOCKER_SYNCD_MLNX_RPC)_CONTAINER_NAME = syncd $(DOCKER_SYNCD_MLNX_RPC)_VERSION = 1.0.0 +$(DOCKER_SYNCD_MLNX_RPC)_PACKAGE_NAME = syncd $(DOCKER_SYNCD_MLNX_RPC)_RUN_OPT += --privileged -t $(DOCKER_SYNCD_MLNX_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf $(DOCKER_SYNCD_MLNX_RPC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro diff --git a/platform/mellanox/docker-syncd-mlnx.mk b/platform/mellanox/docker-syncd-mlnx.mk index c98cbebc01f2..6e6a17c7770a 100644 --- a/platform/mellanox/docker-syncd-mlnx.mk +++ b/platform/mellanox/docker-syncd-mlnx.mk @@ -15,6 +15,7 @@ $(DOCKER_SYNCD_BASE)_DBG_DEPENDS += $(MLNX_SDK_DBG_DEBS) $(MLNX_SAI_DBGSYM) endif $(DOCKER_SYNCD_BASE)_VERSION = 1.0.0 +$(DOCKER_SYNCD_BASE)_PACKAGE_NAME = syncd $(DOCKER_SYNCD_BASE)_RUN_OPT += -v /host/warmboot:/var/warmboot $(DOCKER_SYNCD_BASE)_BASE_IMAGE_FILES += monit_syncd:/etc/monit/conf.d diff --git a/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 b/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 index 5c9ac6c1c145..6ae3c5b7098a 100755 --- a/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 +++ b/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 @@ -2,6 +2,8 @@ FROM docker-config-engine-buster ARG docker_container_name +ARG manifest + RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf RUN mkdir -p /var/run/sx_sdk @@ -39,4 +41,6 @@ COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] COPY ["files/supervisor-proc-exit-listener", "/usr/bin"] COPY ["critical_processes", "/etc/supervisor/"] +LABEL com.azure.sonic.manifest="$manifest" + ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/platform/mellanox/docker-syncd-mlnx/manifest.json.j2 b/platform/mellanox/docker-syncd-mlnx/manifest.json.j2 new file mode 120000 index 000000000000..affca28ad9a9 --- /dev/null +++ b/platform/mellanox/docker-syncd-mlnx/manifest.json.j2 @@ -0,0 +1 @@ +../../template/manifest.json.j2 \ No newline at end of file diff --git a/platform/nephos/docker-syncd-nephos-rpc.mk b/platform/nephos/docker-syncd-nephos-rpc.mk index 8d3eeb55b01c..edc4ffe56076 100644 --- a/platform/nephos/docker-syncd-nephos-rpc.mk +++ b/platform/nephos/docker-syncd-nephos-rpc.mk @@ -19,6 +19,7 @@ endif $(DOCKER_SYNCD_NEPHOS_RPC)_CONTAINER_NAME = syncd $(DOCKER_SYNCD_NEPHOS_RPC)_VERSION = 1.0.0 +$(DOCKER_SYNCD_NEPHOS_RPC)_PACKAGE_NAME = syncd $(DOCKER_SYNCD_NEPHOS_RPC)_RUN_OPT += --net=host --privileged -t $(DOCKER_SYNCD_NEPHOS_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf $(DOCKER_SYNCD_NEPHOS_RPC)_RUN_OPT += -v /host/warmboot:/var/warmboot diff --git a/platform/nephos/docker-syncd-nephos.mk b/platform/nephos/docker-syncd-nephos.mk index f61320cdfaca..7076a3803c7c 100644 --- a/platform/nephos/docker-syncd-nephos.mk +++ b/platform/nephos/docker-syncd-nephos.mk @@ -15,6 +15,7 @@ SONIC_STRETCH_DOCKERS += $(DOCKER_SYNCD_BASE) SONIC_STRETCH_DBG_DOCKERS += $(DOCKER_SYNCD_BASE_DBG) $(DOCKER_SYNCD_BASE)_VERSION = 1.0.0 +$(DOCKER_SYNCD_BASE)_PACKAGE_NAME = syncd $(DOCKER_SYNCD_BASE)_RUN_OPT += -v /host/warmboot:/var/warmboot $(DOCKER_SYNCD_BASE)_RUN_OPT += -v /var/run/docker-syncd:/var/run/sswsyncd diff --git a/platform/nephos/docker-syncd-nephos/Dockerfile.j2 b/platform/nephos/docker-syncd-nephos/Dockerfile.j2 index e142fa04d57d..723f16dfe1b1 100755 --- a/platform/nephos/docker-syncd-nephos/Dockerfile.j2 +++ b/platform/nephos/docker-syncd-nephos/Dockerfile.j2 @@ -1,6 +1,8 @@ FROM docker-config-engine-stretch ARG docker_container_name +ARG manifest + RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf ## Make apt-get non-interactive @@ -43,4 +45,6 @@ COPY ["critical_processes", "/etc/supervisor/"] RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs +LABEL com.azure.sonic.manifest="$manifest" + ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/platform/nephos/docker-syncd-nephos/manifest.json.j2 b/platform/nephos/docker-syncd-nephos/manifest.json.j2 new file mode 120000 index 000000000000..affca28ad9a9 --- /dev/null +++ b/platform/nephos/docker-syncd-nephos/manifest.json.j2 @@ -0,0 +1 @@ +../../template/manifest.json.j2 \ No newline at end of file diff --git a/platform/template/manifest.json.j2 b/platform/template/manifest.json.j2 new file mode 100644 index 000000000000..8ac948b3b152 --- /dev/null +++ b/platform/template/manifest.json.j2 @@ -0,0 +1,13 @@ +{ + "version": "1.0.0", + "package": { + "version": "{{ version }}", + "base-os-contraint": "^1.0.0", + "depends": ["database^1.0.0"] + }, + "service": { + "name": "{{ name }}", + "asic-service": true, + "host-service": false + } +} diff --git a/platform/vs/docker-gbsyncd-vs.mk b/platform/vs/docker-gbsyncd-vs.mk index b19fad685009..50bb8e86b41a 100644 --- a/platform/vs/docker-gbsyncd-vs.mk +++ b/platform/vs/docker-gbsyncd-vs.mk @@ -12,4 +12,6 @@ $(DOCKER_GBSYNCD_BASE)_DBG_DEPENDS += $(SYNCD_VS_DBG) \ $(LIBSAIVS_DBG) $(DOCKER_GBSYNCD_BASE)_VERSION = 1.0.0 +$(DOCKER_GBSYNCD_BASE)_PACKAGE_NAME = gbsyncd + $(DOCKER_GBSYNCD_BASE)_RUN_OPT += -v /host/warmboot:/var/warmboot diff --git a/platform/vs/docker-gbsyncd-vs/Dockerfile.j2 b/platform/vs/docker-gbsyncd-vs/Dockerfile.j2 index d740dca663cb..9286449cfc7f 100644 --- a/platform/vs/docker-gbsyncd-vs/Dockerfile.j2 +++ b/platform/vs/docker-gbsyncd-vs/Dockerfile.j2 @@ -1,6 +1,8 @@ FROM docker-config-engine-buster ARG docker_container_name +ARG manifest + RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf ## Make apt-get non-interactive @@ -31,4 +33,6 @@ COPY ["critical_processes", "/etc/supervisor/"] RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs +LABEL com.azure.sonic.manifest="$manifest" + ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/platform/vs/docker-gbsyncd-vs/manifest.json.j2 b/platform/vs/docker-gbsyncd-vs/manifest.json.j2 new file mode 120000 index 000000000000..affca28ad9a9 --- /dev/null +++ b/platform/vs/docker-gbsyncd-vs/manifest.json.j2 @@ -0,0 +1 @@ +../../template/manifest.json.j2 \ No newline at end of file diff --git a/platform/vs/docker-syncd-vs.mk b/platform/vs/docker-syncd-vs.mk index 3dd112ad4e91..d2f7872ea446 100644 --- a/platform/vs/docker-syncd-vs.mk +++ b/platform/vs/docker-syncd-vs.mk @@ -12,5 +12,6 @@ $(DOCKER_SYNCD_BASE)_DBG_DEPENDS += $(SYNCD_VS_DBG) \ $(LIBSAIVS_DBG) $(DOCKER_SYNCD_BASE)_VERSION = 1.0.0 +$(DOCKER_SYNCD_BASE)_PACKAGE_NAME = syncd $(DOCKER_SYNCD_BASE)_RUN_OPT += -v /host/warmboot:/var/warmboot diff --git a/platform/vs/docker-syncd-vs/Dockerfile.j2 b/platform/vs/docker-syncd-vs/Dockerfile.j2 index 1ef1245e14fb..1907015d42f6 100644 --- a/platform/vs/docker-syncd-vs/Dockerfile.j2 +++ b/platform/vs/docker-syncd-vs/Dockerfile.j2 @@ -1,6 +1,8 @@ FROM docker-config-engine-buster ARG docker_container_name +ARG manifest + RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf ## Make apt-get non-interactive @@ -31,4 +33,6 @@ COPY ["critical_processes", "/etc/supervisor/"] RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs +LABEL com.azure.sonic.manifest="$manifest" + ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/platform/vs/docker-syncd-vs/manifest.json.j2 b/platform/vs/docker-syncd-vs/manifest.json.j2 new file mode 120000 index 000000000000..affca28ad9a9 --- /dev/null +++ b/platform/vs/docker-syncd-vs/manifest.json.j2 @@ -0,0 +1 @@ +../../template/manifest.json.j2 \ No newline at end of file diff --git a/rules/docker-database.mk b/rules/docker-database.mk index ab2ce3582662..1f903788020c 100644 --- a/rules/docker-database.mk +++ b/rules/docker-database.mk @@ -13,6 +13,7 @@ $(DOCKER_DATABASE)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_IMA $(DOCKER_DATABASE)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER) $(DOCKER_DATABASE)_VERSION = 1.0.0 +$(DOCKER_DATABASE)_PACKAGE_NAME = database SONIC_DOCKER_IMAGES += $(DOCKER_DATABASE) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_DATABASE) diff --git a/rules/docker-dhcp-relay.mk b/rules/docker-dhcp-relay.mk index 0412d2550247..ecbf9d38ded1 100644 --- a/rules/docker-dhcp-relay.mk +++ b/rules/docker-dhcp-relay.mk @@ -15,6 +15,7 @@ $(DOCKER_DHCP_RELAY)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_I $(DOCKER_DHCP_RELAY)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE_BUSTER) $(DOCKER_DHCP_RELAY)_VERSION = 1.0.0 +$(DOCKER_DHCP_RELAY)_PACKAGE_NAME = dhcp-relay SONIC_DOCKER_IMAGES += $(DOCKER_DHCP_RELAY) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_DHCP_RELAY) diff --git a/rules/docker-fpm-frr.mk b/rules/docker-fpm-frr.mk index 07516ef0a1e5..6405b8aac03e 100644 --- a/rules/docker-fpm-frr.mk +++ b/rules/docker-fpm-frr.mk @@ -17,6 +17,7 @@ $(DOCKER_FPM_FRR)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_IMAG $(DOCKER_FPM_FRR)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER) $(DOCKER_FPM_FRR)_VERSION = 1.0.0 +$(DOCKER_FPM_FRR)_PACKAGE_NAME = fpm-frr SONIC_DOCKER_IMAGES += $(DOCKER_FPM_FRR) diff --git a/rules/docker-fpm-gobgp.mk b/rules/docker-fpm-gobgp.mk index 8a285f3a6dc9..a773651ae14f 100644 --- a/rules/docker-fpm-gobgp.mk +++ b/rules/docker-fpm-gobgp.mk @@ -6,6 +6,7 @@ $(DOCKER_FPM_GOBGP)_DEPENDS += $(GOBGP) $(DOCKER_FPM_GOBGP)_LOAD_DOCKERS += $(DOCKER_FPM_QUAGGA) $(DOCKER_FPM_GOBGP)_VERSION = 1.0.0 +$(DOCKER_FPM_GOBGP)_PACKAGE_NAME = fpm-gobgp SONIC_DOCKER_IMAGES += $(DOCKER_FPM_GOBGP) diff --git a/rules/docker-fpm-quagga.mk b/rules/docker-fpm-quagga.mk index ec77e7c32928..658ac8f3fef7 100644 --- a/rules/docker-fpm-quagga.mk +++ b/rules/docker-fpm-quagga.mk @@ -6,6 +6,7 @@ $(DOCKER_FPM_QUAGGA)_DEPENDS += $(QUAGGA) $(SWSS) $(DOCKER_FPM_QUAGGA)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) $(DOCKER_FPM_QUAGGA)_VERSION = 1.0.0 +$(DOCKER_FPM_QUAGGA)_PACKAGE_NAME = fpm-quagga SONIC_DOCKER_IMAGES += $(DOCKER_FPM_QUAGGA) diff --git a/rules/docker-iccpd.mk b/rules/docker-iccpd.mk index aa29bdc3050e..69b9fee50eef 100644 --- a/rules/docker-iccpd.mk +++ b/rules/docker-iccpd.mk @@ -11,6 +11,7 @@ $(DOCKER_ICCPD)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_IMAGE_ $(DOCKER_ICCPD)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER) $(DOCKER_ICCPD)_VERSION = 1.0.0 +$(DOCKER_ICCPD)_ICCPD = iccpd ifeq ($(INCLUDE_ICCPD), y) SONIC_DOCKER_IMAGES += $(DOCKER_ICCPD) diff --git a/rules/docker-lldp.mk b/rules/docker-lldp.mk index 2ccf375e25cd..0ee4943175f0 100644 --- a/rules/docker-lldp.mk +++ b/rules/docker-lldp.mk @@ -17,6 +17,7 @@ $(DOCKER_LLDP)_PYTHON_WHEELS += $(DBSYNCD_PY2) $(DOCKER_LLDP)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER) $(DOCKER_LLDP)_VERSION = 1.0.0 +$(DOCKER_LLDP)_PACKAGE_NAME = lldp SONIC_DOCKER_IMAGES += $(DOCKER_LLDP) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_LLDP) diff --git a/rules/docker-nat.mk b/rules/docker-nat.mk index e84174088f0b..6c958bb8ecfa 100644 --- a/rules/docker-nat.mk +++ b/rules/docker-nat.mk @@ -14,6 +14,7 @@ $(DOCKER_NAT)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_IMAGE_PA $(DOCKER_NAT)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER) $(DOCKER_NAT)_VERSION = 1.0.0 +$(DOCKER_NAT)_PACKAGE_NAME = nat ifeq ($(INCLUDE_NAT), y) SONIC_DOCKER_IMAGES += $(DOCKER_NAT) diff --git a/rules/docker-orchagent.mk b/rules/docker-orchagent.mk index 91e9ea1623a0..ff54642d8ffe 100644 --- a/rules/docker-orchagent.mk +++ b/rules/docker-orchagent.mk @@ -18,6 +18,7 @@ $(DOCKER_ORCHAGENT)_PATH = $(DOCKERS_PATH)/$(DOCKER_ORCHAGENT_STEM) $(DOCKER_ORCHAGENT)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER) $(DOCKER_ORCHAGENT)_VERSION = 1.0.0 +$(DOCKER_ORCHAGENT)_PACKAGE_NAME = swss SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ORCHAGENT) diff --git a/rules/docker-platform-monitor.mk b/rules/docker-platform-monitor.mk index 1307d0dee62b..57b20e014c07 100644 --- a/rules/docker-platform-monitor.mk +++ b/rules/docker-platform-monitor.mk @@ -36,6 +36,7 @@ $(DOCKER_PLATFORM_MONITOR)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER) $(DOCKER_PLATFORM_MONITOR)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE_BUSTER) $(DOCKER_PLATFORM_MONITOR)_VERSION = 1.0.0 +$(DOCKER_PLATFORM_MONITOR)_PACKAGE_NAME = pmon SONIC_DOCKER_IMAGES += $(DOCKER_PLATFORM_MONITOR) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_PLATFORM_MONITOR) diff --git a/rules/docker-restapi.mk b/rules/docker-restapi.mk index d9d6bb34a311..2bdc1a6a9940 100644 --- a/rules/docker-restapi.mk +++ b/rules/docker-restapi.mk @@ -11,6 +11,7 @@ $(DOCKER_RESTAPI)_PATH = $(DOCKERS_PATH)/$(DOCKER_RESTAPI_STEM) $(DOCKER_RESTAPI)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_STRETCH) $(DOCKER_RESTAPI)_VERSION = 1.0.0 +$(DOCKER_RESTAPI)_PACKAGE_NAME = restapi ifeq ($(INCLUDE_RESTAPI), y) SONIC_DOCKER_IMAGES += $(DOCKER_RESTAPI) diff --git a/rules/docker-router-advertiser.mk b/rules/docker-router-advertiser.mk index adc06f4ea5f5..eb3e3268f27b 100644 --- a/rules/docker-router-advertiser.mk +++ b/rules/docker-router-advertiser.mk @@ -14,6 +14,7 @@ $(DOCKER_ROUTER_ADVERTISER)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER $(DOCKER_ROUTER_ADVERTISER)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE_BUSTER) $(DOCKER_ROUTER_ADVERTISER)_VERSION = 1.0.0 +$(DOCKER_ROUTER_ADVERTISER)_PACKAGE_NAME = radv SONIC_DOCKER_IMAGES += $(DOCKER_ROUTER_ADVERTISER) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ROUTER_ADVERTISER) diff --git a/rules/docker-sflow.mk b/rules/docker-sflow.mk index 9a909e2d4723..959afed883e5 100644 --- a/rules/docker-sflow.mk +++ b/rules/docker-sflow.mk @@ -14,6 +14,7 @@ $(DOCKER_SFLOW)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_IMAGE_ $(DOCKER_SFLOW)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER) $(DOCKER_SFLOW)_VERSION = 1.0.0 +$(DOCKER_SFLOW)_PACKAGE_NAME = sflow SONIC_DOCKER_IMAGES += $(DOCKER_SFLOW) ifeq ($(INCLUDE_SFLOW), y) diff --git a/rules/docker-snmp.mk b/rules/docker-snmp.mk index 7241f688faf9..c433e2079a3f 100644 --- a/rules/docker-snmp.mk +++ b/rules/docker-snmp.mk @@ -18,6 +18,7 @@ $(DOCKER_SNMP)_PYTHON_WHEELS += $(SONIC_PY_COMMON_PY3) $(SONIC_PLATFORM_COMMON_P $(DOCKER_SNMP)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER) $(DOCKER_SNMP)_VERSION = 1.0.0 +$(DOCKER_SNMP)_PACKAGE_NAME = snmp SONIC_DOCKER_IMAGES += $(DOCKER_SNMP) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SNMP) diff --git a/rules/docker-sonic-mgmt-framework.mk b/rules/docker-sonic-mgmt-framework.mk index d0137ee034fb..ef1d55990816 100644 --- a/rules/docker-sonic-mgmt-framework.mk +++ b/rules/docker-sonic-mgmt-framework.mk @@ -15,6 +15,7 @@ SONIC_DOCKER_IMAGES += $(DOCKER_MGMT_FRAMEWORK) $(DOCKER_MGMT_FRAMEWORK)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER) $(DOCKER_MGMT_FRAMEWORK)_VERSION = 1.0.0 +$(DOCKER_MGMT_FRAMEWORK)_PACKAGE_NAME = mgmt-framework $(DOCKER_MGMT_FRAMEWORK)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_IMAGE_PACKAGES) diff --git a/rules/docker-teamd.mk b/rules/docker-teamd.mk index 63c12196d5d6..088860fb5d68 100644 --- a/rules/docker-teamd.mk +++ b/rules/docker-teamd.mk @@ -16,6 +16,7 @@ $(DOCKER_TEAMD)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_IMAGE_ $(DOCKER_TEAMD)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER) $(DOCKER_TEAMD)_VERSION = 1.0.0 +$(DOCKER_TEAMD)_PACKAGE_NAME = teamd SONIC_DOCKER_IMAGES += $(DOCKER_TEAMD) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_TEAMD) diff --git a/rules/docker-telemetry.mk b/rules/docker-telemetry.mk index dcd02a665722..097df1f7b7db 100644 --- a/rules/docker-telemetry.mk +++ b/rules/docker-telemetry.mk @@ -13,6 +13,7 @@ $(DOCKER_TELEMETRY)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_DEPENDS) $(DOCKER_TELEMETRY)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER) $(DOCKER_TELEMETRY)_VERSION = 1.0.0 +$(DOCKER_TELEMETRY)_PACKAGE_NAME = telemetry $(DOCKER_TELEMETRY)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_IMAGE_PACKAGES) diff --git a/slave.mk b/slave.mk index 173e2716f8c2..a71b6a42a07b 100644 --- a/slave.mk +++ b/slave.mk @@ -729,6 +729,12 @@ $(addprefix $(TARGET_PATH)/, $(DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .platform --build-arg docker_container_name=$($*.gz_CONTAINER_NAME) \ --build-arg frr_user_uid=$(FRR_USER_UID) \ --build-arg frr_user_gid=$(FRR_USER_GID) \ + --build-arg \ + manifest='$(shell \ + [ -f $($*.gz_PATH)/manifest.json.j2 ] && \ + version=$($*.gz_VERSION) \ + name=$($*.gz_CONTAINER_NAME) \ + j2 $($*.gz_PATH)/manifest.json.j2)' \ --label Tag=$(SONIC_IMAGE_VERSION) \ -t $* $($*.gz_PATH) $(LOG) docker save $* | gzip -c > $@ @@ -868,7 +874,10 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ export enable_pfcwd_on_start="$(ENABLE_PFCWD_ON_START)" export installer_debs="$(addprefix $(IMAGE_DISTRO_DEBS_PATH)/,$($*_INSTALLS))" export lazy_installer_debs="$(foreach deb, $($*_LAZY_INSTALLS),$(foreach device, $($(deb)_PLATFORM),$(addprefix $(device)@, $(IMAGE_DISTRO_DEBS_PATH)/$(deb))))" - export installer_images="$(foreach docker, $($*_DOCKERS),$(addprefix $(TARGET_PATH)/,$(addsuffix :$($(docker)_VERSION),$(docker))))" + export installer_images="$(foreach docker, $($*_DOCKERS),\ + $(addprefix $($(docker)_PACKAGE_NAME)|,\ + $(addprefix $($(docker)_PATH)|,\ + $(addprefix $(TARGET_PATH)/,$(addsuffix :$($(docker)_VERSION),$(docker))))))" export sonic_py_common_py2_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_PY_COMMON_PY2))" export sonic_py_common_py3_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_PY_COMMON_PY3))" export config_engine_py2_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_CONFIG_ENGINE_PY2))" From 855fa603b10542332e5fccfa695681e3b03f218b Mon Sep 17 00:00:00 2001 From: Stepan Blyshchak Date: Mon, 16 Nov 2020 12:33:32 +0200 Subject: [PATCH 04/44] [dockers] add package name to manifest Signed-off-by: Stepan Blyshchak --- dockers/docker-database/manifest.json.j2 | 3 ++- dockers/docker-dhcp-relay/manifest.json.j2 | 6 +++++- dockers/docker-fpm-frr/manifest.json.j2 | 11 +++++++++-- dockers/docker-fpm-gobgp/manifest.json.j2 | 11 +++++++++-- dockers/docker-fpm-quagga/manifest.json.j2 | 11 +++++++++-- dockers/docker-iccpd/manifest.json.j2 | 6 +++++- dockers/docker-lldp/manifest.json.j2 | 6 +++++- dockers/docker-nat/manifest.json.j2 | 6 +++++- dockers/docker-orchagent/manifest.json.j2 | 6 +++++- dockers/docker-platform-monitor/manifest.json.j2 | 5 ++++- dockers/docker-router-advertiser/manifest.json.j2 | 6 +++++- dockers/docker-sflow/manifest.json.j2 | 6 +++++- dockers/docker-snmp/manifest.json.j2 | 6 +++++- dockers/docker-sonic-mgmt-framework/manifest.json.j2 | 6 +++++- dockers/docker-sonic-restapi/manifest.json.j2 | 6 +++++- dockers/docker-sonic-telemetry/manifest.json.j2 | 6 +++++- dockers/docker-teamd/manifest.json.j2 | 6 +++++- platform/template/manifest.json.j2 | 5 ++++- slave.mk | 1 + 19 files changed, 98 insertions(+), 21 deletions(-) diff --git a/dockers/docker-database/manifest.json.j2 b/dockers/docker-database/manifest.json.j2 index 07d43898ff12..c08f7acfb849 100644 --- a/dockers/docker-database/manifest.json.j2 +++ b/dockers/docker-database/manifest.json.j2 @@ -2,7 +2,8 @@ "version": "1.0.0", "package": { "version": "{{ version }}", - "base-os-contraint": "^1.0.0" + "base-os-contraint": "^1.0.0", + "name": "{{ package_name }}" }, "service": { "name": "{{ name }}", diff --git a/dockers/docker-dhcp-relay/manifest.json.j2 b/dockers/docker-dhcp-relay/manifest.json.j2 index a76b30f9f0ab..bbce95399868 100644 --- a/dockers/docker-dhcp-relay/manifest.json.j2 +++ b/dockers/docker-dhcp-relay/manifest.json.j2 @@ -3,7 +3,11 @@ "package": { "version": "{{ version }}", "base-os-contraint": "^1.0.0", - "depends": ["database^1.0.0", "swss^1.0.0"] + "depends": [ + "database^1.0.0", + "swss^1.0.0" + ], + "name": "{{ package_name }}" }, "service": { "name": "{{ name }}", diff --git a/dockers/docker-fpm-frr/manifest.json.j2 b/dockers/docker-fpm-frr/manifest.json.j2 index 1daeb738c784..dfc63fca1a6d 100644 --- a/dockers/docker-fpm-frr/manifest.json.j2 +++ b/dockers/docker-fpm-frr/manifest.json.j2 @@ -3,8 +3,15 @@ "package": { "version": "{{ version }}", "base-os-contraint": "^1.0.0", - "depends": ["database^1.0.0", "swss^1.0.0"], - "conflicts": ["fpm-gobgp", "fpm-quagga"] + "depends": [ + "database^1.0.0", + "swss^1.0.0" + ], + "conflicts": [ + "fpm-gobgp", + "fpm-quagga" + ], + "name": "{{ package_name }}" }, "service": { "name": "{{ name }}", diff --git a/dockers/docker-fpm-gobgp/manifest.json.j2 b/dockers/docker-fpm-gobgp/manifest.json.j2 index 9b8a5a11870f..982772f1aafa 100644 --- a/dockers/docker-fpm-gobgp/manifest.json.j2 +++ b/dockers/docker-fpm-gobgp/manifest.json.j2 @@ -3,8 +3,15 @@ "package": { "version": "{{ version }}", "base-os-contraint": "^1.0.0", - "depends": ["database^1.0.0", "swss^1.0.0"], - "conflicts": ["fpm-frr", "fpm-quagga"] + "depends": [ + "database^1.0.0", + "swss^1.0.0" + ], + "conflicts": [ + "fpm-frr", + "fpm-quagga" + ], + "name": "{{ package_name }}" }, "service": { "name": "{{ name }}", diff --git a/dockers/docker-fpm-quagga/manifest.json.j2 b/dockers/docker-fpm-quagga/manifest.json.j2 index cd5734259e46..1f2daf816ea6 100644 --- a/dockers/docker-fpm-quagga/manifest.json.j2 +++ b/dockers/docker-fpm-quagga/manifest.json.j2 @@ -3,8 +3,15 @@ "package": { "version": "{{ version }}", "base-os-contraint": "^1.0.0", - "depends": ["database^1.0.0", "swss^1.0.0"], - "conflicts": ["fpm-gobgp", "fpm-frr"] + "depends": [ + "database^1.0.0", + "swss^1.0.0" + ], + "conflicts": [ + "fpm-gobgp", + "fpm-frr" + ], + "name": "{{ package_name }}" }, "service": { "name": "{{ name }}", diff --git a/dockers/docker-iccpd/manifest.json.j2 b/dockers/docker-iccpd/manifest.json.j2 index a76b30f9f0ab..bbce95399868 100644 --- a/dockers/docker-iccpd/manifest.json.j2 +++ b/dockers/docker-iccpd/manifest.json.j2 @@ -3,7 +3,11 @@ "package": { "version": "{{ version }}", "base-os-contraint": "^1.0.0", - "depends": ["database^1.0.0", "swss^1.0.0"] + "depends": [ + "database^1.0.0", + "swss^1.0.0" + ], + "name": "{{ package_name }}" }, "service": { "name": "{{ name }}", diff --git a/dockers/docker-lldp/manifest.json.j2 b/dockers/docker-lldp/manifest.json.j2 index d86a71f9f781..d1edab0d4d98 100644 --- a/dockers/docker-lldp/manifest.json.j2 +++ b/dockers/docker-lldp/manifest.json.j2 @@ -3,7 +3,11 @@ "package": { "version": "{{ version }}", "base-os-contraint": "^1.0.0", - "depends": ["database^1.0.0", "swss^1.0.0"] + "depends": [ + "database^1.0.0", + "swss^1.0.0" + ], + "name": "{{ package_name }}" }, "service": { "name": "{{ name }}", diff --git a/dockers/docker-nat/manifest.json.j2 b/dockers/docker-nat/manifest.json.j2 index a76b30f9f0ab..bbce95399868 100644 --- a/dockers/docker-nat/manifest.json.j2 +++ b/dockers/docker-nat/manifest.json.j2 @@ -3,7 +3,11 @@ "package": { "version": "{{ version }}", "base-os-contraint": "^1.0.0", - "depends": ["database^1.0.0", "swss^1.0.0"] + "depends": [ + "database^1.0.0", + "swss^1.0.0" + ], + "name": "{{ package_name }}" }, "service": { "name": "{{ name }}", diff --git a/dockers/docker-orchagent/manifest.json.j2 b/dockers/docker-orchagent/manifest.json.j2 index 6f81022833a3..ac3d07d87564 100644 --- a/dockers/docker-orchagent/manifest.json.j2 +++ b/dockers/docker-orchagent/manifest.json.j2 @@ -3,7 +3,11 @@ "package": { "version": "{{ version }}", "base-os-contraint": "^1.0.0", - "depends": ["database^1.0.0", "syncd^1.0.0"] + "depends": [ + "database^1.0.0", + "syncd^1.0.0" + ], + "name": "{{ package_name }}" }, "service": { "name": "{{ name }}", diff --git a/dockers/docker-platform-monitor/manifest.json.j2 b/dockers/docker-platform-monitor/manifest.json.j2 index 82f296666838..11e5a832d39c 100644 --- a/dockers/docker-platform-monitor/manifest.json.j2 +++ b/dockers/docker-platform-monitor/manifest.json.j2 @@ -3,7 +3,10 @@ "package": { "version": "{{ version }}", "base-os-contraint": "^1.0.0", - "depends": ["database^1.0.0"] + "depends": [ + "database^1.0.0" + ], + "name": "{{ package_name }}" }, "service": { "name": "{{ name }}", diff --git a/dockers/docker-router-advertiser/manifest.json.j2 b/dockers/docker-router-advertiser/manifest.json.j2 index a76b30f9f0ab..bbce95399868 100644 --- a/dockers/docker-router-advertiser/manifest.json.j2 +++ b/dockers/docker-router-advertiser/manifest.json.j2 @@ -3,7 +3,11 @@ "package": { "version": "{{ version }}", "base-os-contraint": "^1.0.0", - "depends": ["database^1.0.0", "swss^1.0.0"] + "depends": [ + "database^1.0.0", + "swss^1.0.0" + ], + "name": "{{ package_name }}" }, "service": { "name": "{{ name }}", diff --git a/dockers/docker-sflow/manifest.json.j2 b/dockers/docker-sflow/manifest.json.j2 index a76b30f9f0ab..bbce95399868 100644 --- a/dockers/docker-sflow/manifest.json.j2 +++ b/dockers/docker-sflow/manifest.json.j2 @@ -3,7 +3,11 @@ "package": { "version": "{{ version }}", "base-os-contraint": "^1.0.0", - "depends": ["database^1.0.0", "swss^1.0.0"] + "depends": [ + "database^1.0.0", + "swss^1.0.0" + ], + "name": "{{ package_name }}" }, "service": { "name": "{{ name }}", diff --git a/dockers/docker-snmp/manifest.json.j2 b/dockers/docker-snmp/manifest.json.j2 index a76b30f9f0ab..bbce95399868 100644 --- a/dockers/docker-snmp/manifest.json.j2 +++ b/dockers/docker-snmp/manifest.json.j2 @@ -3,7 +3,11 @@ "package": { "version": "{{ version }}", "base-os-contraint": "^1.0.0", - "depends": ["database^1.0.0", "swss^1.0.0"] + "depends": [ + "database^1.0.0", + "swss^1.0.0" + ], + "name": "{{ package_name }}" }, "service": { "name": "{{ name }}", diff --git a/dockers/docker-sonic-mgmt-framework/manifest.json.j2 b/dockers/docker-sonic-mgmt-framework/manifest.json.j2 index a76b30f9f0ab..bbce95399868 100644 --- a/dockers/docker-sonic-mgmt-framework/manifest.json.j2 +++ b/dockers/docker-sonic-mgmt-framework/manifest.json.j2 @@ -3,7 +3,11 @@ "package": { "version": "{{ version }}", "base-os-contraint": "^1.0.0", - "depends": ["database^1.0.0", "swss^1.0.0"] + "depends": [ + "database^1.0.0", + "swss^1.0.0" + ], + "name": "{{ package_name }}" }, "service": { "name": "{{ name }}", diff --git a/dockers/docker-sonic-restapi/manifest.json.j2 b/dockers/docker-sonic-restapi/manifest.json.j2 index a76b30f9f0ab..bbce95399868 100644 --- a/dockers/docker-sonic-restapi/manifest.json.j2 +++ b/dockers/docker-sonic-restapi/manifest.json.j2 @@ -3,7 +3,11 @@ "package": { "version": "{{ version }}", "base-os-contraint": "^1.0.0", - "depends": ["database^1.0.0", "swss^1.0.0"] + "depends": [ + "database^1.0.0", + "swss^1.0.0" + ], + "name": "{{ package_name }}" }, "service": { "name": "{{ name }}", diff --git a/dockers/docker-sonic-telemetry/manifest.json.j2 b/dockers/docker-sonic-telemetry/manifest.json.j2 index a76b30f9f0ab..bbce95399868 100644 --- a/dockers/docker-sonic-telemetry/manifest.json.j2 +++ b/dockers/docker-sonic-telemetry/manifest.json.j2 @@ -3,7 +3,11 @@ "package": { "version": "{{ version }}", "base-os-contraint": "^1.0.0", - "depends": ["database^1.0.0", "swss^1.0.0"] + "depends": [ + "database^1.0.0", + "swss^1.0.0" + ], + "name": "{{ package_name }}" }, "service": { "name": "{{ name }}", diff --git a/dockers/docker-teamd/manifest.json.j2 b/dockers/docker-teamd/manifest.json.j2 index 4766bbde8b26..e21b557a079d 100644 --- a/dockers/docker-teamd/manifest.json.j2 +++ b/dockers/docker-teamd/manifest.json.j2 @@ -3,7 +3,11 @@ "package": { "version": "{{ version }}", "base-os-contraint": "^1.0.0", - "depends": ["database^1.0.0", "swss^1.0.0"] + "depends": [ + "database^1.0.0", + "swss^1.0.0" + ], + "name": "{{ package_name }}" }, "service": { "name": "{{ name }}", diff --git a/platform/template/manifest.json.j2 b/platform/template/manifest.json.j2 index 8ac948b3b152..7c2528a3bb43 100644 --- a/platform/template/manifest.json.j2 +++ b/platform/template/manifest.json.j2 @@ -3,7 +3,10 @@ "package": { "version": "{{ version }}", "base-os-contraint": "^1.0.0", - "depends": ["database^1.0.0"] + "depends": [ + "database^1.0.0" + ], + "name": "{{ package_name }}" }, "service": { "name": "{{ name }}", diff --git a/slave.mk b/slave.mk index a71b6a42a07b..12dd3bf7b6bd 100644 --- a/slave.mk +++ b/slave.mk @@ -734,6 +734,7 @@ $(addprefix $(TARGET_PATH)/, $(DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .platform [ -f $($*.gz_PATH)/manifest.json.j2 ] && \ version=$($*.gz_VERSION) \ name=$($*.gz_CONTAINER_NAME) \ + package_name=$($*.gz_PACKAGE_NAME) \ j2 $($*.gz_PATH)/manifest.json.j2)' \ --label Tag=$(SONIC_IMAGE_VERSION) \ -t $* $($*.gz_PATH) $(LOG) From 44685baeaa594e3390f3e7f351d430fd459bf5e6 Mon Sep 17 00:00:00 2001 From: Stepan Blyshchak Date: Mon, 16 Nov 2020 22:31:51 +0200 Subject: [PATCH 05/44] remove swss dependency from dhcp-relay & router-advertiser Signed-off-by: Stepan Blyshchak --- dockers/docker-dhcp-relay/manifest.json.j2 | 3 +-- dockers/docker-router-advertiser/manifest.json.j2 | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/dockers/docker-dhcp-relay/manifest.json.j2 b/dockers/docker-dhcp-relay/manifest.json.j2 index bbce95399868..11e5a832d39c 100644 --- a/dockers/docker-dhcp-relay/manifest.json.j2 +++ b/dockers/docker-dhcp-relay/manifest.json.j2 @@ -4,8 +4,7 @@ "version": "{{ version }}", "base-os-contraint": "^1.0.0", "depends": [ - "database^1.0.0", - "swss^1.0.0" + "database^1.0.0" ], "name": "{{ package_name }}" }, diff --git a/dockers/docker-router-advertiser/manifest.json.j2 b/dockers/docker-router-advertiser/manifest.json.j2 index bbce95399868..11e5a832d39c 100644 --- a/dockers/docker-router-advertiser/manifest.json.j2 +++ b/dockers/docker-router-advertiser/manifest.json.j2 @@ -4,8 +4,7 @@ "version": "{{ version }}", "base-os-contraint": "^1.0.0", "depends": [ - "database^1.0.0", - "swss^1.0.0" + "database^1.0.0" ], "name": "{{ package_name }}" }, From ed1bd3f8a0100fd20f0b563d1bd50e8fdd248e4c Mon Sep 17 00:00:00 2001 From: Stepan Blyshchak Date: Wed, 13 Jan 2021 15:23:39 +0200 Subject: [PATCH 06/44] remove sonic-sdk added by mistake in this change Signed-off-by: Stepan Blyshchak --- dockers/docker-sonic-sdk/Dockerfile.j2 | 79 -------------------------- 1 file changed, 79 deletions(-) delete mode 100644 dockers/docker-sonic-sdk/Dockerfile.j2 diff --git a/dockers/docker-sonic-sdk/Dockerfile.j2 b/dockers/docker-sonic-sdk/Dockerfile.j2 deleted file mode 100644 index b74aec7f1973..000000000000 --- a/dockers/docker-sonic-sdk/Dockerfile.j2 +++ /dev/null @@ -1,79 +0,0 @@ -{% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} -FROM docker-config-engine-buster - -## Make apt-get non-interactive -ENV DEBIAN_FRONTEND=noninteractive - -RUN apt-get update && \ - apt-get install -f -y \ - ifupdown \ - arping \ - libdbus-1-3 \ - libdaemon0 \ - libjansson4 \ - libpython2.7 \ - iproute2 \ - ndisc6 \ - tcpdump \ - libatomic1 \ - libjemalloc1 \ - liblua5.1-0 \ - lua-bitop \ - lua-cjson \ - libelf1 \ - libmnl0 \ - bridge-utils - - -## Build tools -RUN apt-get update && \ - apt-get install -f -y \ - autoconf \ - automake \ - libtool \ - curl \ - make \ - g++ \ - gcc \ - vim \ - git \ - unzip - -{% if ( CONFIGURED_ARCH == "armhf" or CONFIGURED_ARCH == "arm64" ) %} -## Fix for gcc/python not found in arm docker -RUN apt-get install -f -y python2.7 python2.7-dev -RUN apt-get install -y gcc-6 -{% endif %} -{% if CONFIGURED_ARCH == "armhf" %} -RUN ln -s -f /usr/bin/gcc-6 /usr/bin/arm-linux-gnueabihf-gcc -{% endif %} -{% if CONFIGURED_ARCH == "arm64" %} -RUN ln -s -f /usr/bin/gcc-6 /usr/bin/aarch64-linux-gnu-gcc -{% endif %} - -#RUN pip install \ -# scapy==2.4.2 \ -# setuptools \ -# pyroute2==0.5.3 -#RUN pip install \ -# netifaces==0.10.7 \ -# monotonic==1.5 - -{% if ( CONFIGURED_ARCH == "armhf" or CONFIGURED_ARCH == "arm64" ) %} -# Remove installed gcc -RUN apt-get remove -y gcc-6 -{% endif %} - -{% if docker_sonic_sdk_debs.strip() -%} -# Copy locally-built Debian package dependencies -{{ copy_files("debs/", docker_sonic_sdk_debs.split(' '), "/debs/") }} - -# Install locally-built Debian packages and implicitly install their dependencies -{{ install_debian_packages(docker_sonic_sdk_debs.split(' ')) }} -{%- endif %} - -## Clean up -RUN apt-get clean -y && \ - apt-get autoclean -y && \ - apt-get autoremove -y && \ - rm -rf /debs From 9bc446462a40ed0c48b22e7f2fa5c1635da99172 Mon Sep 17 00:00:00 2001 From: Stepan Blyschak Date: Mon, 18 Jan 2021 09:26:35 +0000 Subject: [PATCH 07/44] [dhcp-relay] make DHCP relay an extension Signed-off-by: Stepan Blyschak --- Makefile.work | 1 + .../cli/config/plugins/dhcp_relay.py | 84 +++++++++++++++++++ .../cli/show/plugins/dhcp_relay.py | 22 +++++ dockers/docker-dhcp-relay/manifest.json.j2 | 27 ++++++ files/build_templates/init_cfg.json.j2 | 3 +- .../build_templates/sonic_debian_extension.j2 | 22 +++++ files/scripts/swss.sh | 11 ++- rules/config | 3 + rules/docker-dhcp-relay.mk | 18 ++-- rules/sonic-packages.mk | 9 ++ slave.mk | 15 +++- 11 files changed, 204 insertions(+), 11 deletions(-) create mode 100644 dockers/docker-dhcp-relay/cli/config/plugins/dhcp_relay.py create mode 100644 dockers/docker-dhcp-relay/cli/show/plugins/dhcp_relay.py create mode 100644 rules/sonic-packages.mk diff --git a/Makefile.work b/Makefile.work index 0d7f62af3917..4a768fc717af 100644 --- a/Makefile.work +++ b/Makefile.work @@ -241,6 +241,7 @@ SONIC_BUILD_INSTRUCTION := make \ HTTP_PROXY=$(http_proxy) \ HTTPS_PROXY=$(https_proxy) \ SONIC_INCLUDE_SYSTEM_TELEMETRY=$(INCLUDE_SYSTEM_TELEMETRY) \ + INCLUDE_DHCP_RELAY=$(INCLUDE_DHCP_RELAY) \ SONIC_INCLUDE_RESTAPI=$(INCLUDE_RESTAPI) \ TELEMETRY_WRITABLE=$(TELEMETRY_WRITABLE) \ EXTRA_DOCKER_TARGETS=$(EXTRA_DOCKER_TARGETS) \ diff --git a/dockers/docker-dhcp-relay/cli/config/plugins/dhcp_relay.py b/dockers/docker-dhcp-relay/cli/config/plugins/dhcp_relay.py new file mode 100644 index 000000000000..e3cdd8304654 --- /dev/null +++ b/dockers/docker-dhcp-relay/cli/config/plugins/dhcp_relay.py @@ -0,0 +1,84 @@ +import click +import utilities_common.cli as clicommon + +@click.group(cls=clicommon.AbbreviationGroup, name='dhcp_relay') +def vlan_dhcp_relay(): + pass + +@vlan_dhcp_relay.command('add') +@click.argument('vid', metavar='', required=True, type=int) +@click.argument('dhcp_relay_destination_ip', metavar='', required=True) +@clicommon.pass_db +def add_vlan_dhcp_relay_destination(db, vid, dhcp_relay_destination_ip): + """ Add a destination IP address to the VLAN's DHCP relay """ + + ctx = click.get_current_context() + + if not clicommon.is_ipaddress(dhcp_relay_destination_ip): + ctx.fail('{} is invalid IP address'.format(dhcp_relay_destination_ip)) + + vlan_name = 'Vlan{}'.format(vid) + vlan = db.cfgdb.get_entry('VLAN', vlan_name) + if len(vlan) == 0: + ctx.fail("{} doesn't exist".format(vlan_name)) + + dhcp_relay_dests = vlan.get('dhcp_servers', []) + if dhcp_relay_destination_ip in dhcp_relay_dests: + click.echo("{} is already a DHCP relay destination for {}".format(dhcp_relay_destination_ip, vlan_name)) + return + + dhcp_relay_dests.append(dhcp_relay_destination_ip) + vlan['dhcp_servers'] = dhcp_relay_dests + db.cfgdb.set_entry('VLAN', vlan_name, vlan) + click.echo("Added DHCP relay destination address {} to {}".format(dhcp_relay_destination_ip, vlan_name)) + try: + click.echo("Restarting DHCP relay service...") + clicommon.run_command("systemctl stop dhcp_relay", display_cmd=False) + clicommon.run_command("systemctl reset-failed dhcp_relay", display_cmd=False) + clicommon.run_command("systemctl start dhcp_relay", display_cmd=False) + except SystemExit as e: + ctx.fail("Restart service dhcp_relay failed with error {}".format(e)) + +@vlan_dhcp_relay.command('del') +@click.argument('vid', metavar='', required=True, type=int) +@click.argument('dhcp_relay_destination_ip', metavar='', required=True) +@clicommon.pass_db +def del_vlan_dhcp_relay_destination(db, vid, dhcp_relay_destination_ip): + """ Remove a destination IP address from the VLAN's DHCP relay """ + + ctx = click.get_current_context() + + if not clicommon.is_ipaddress(dhcp_relay_destination_ip): + ctx.fail('{} is invalid IP address'.format(dhcp_relay_destination_ip)) + + vlan_name = 'Vlan{}'.format(vid) + vlan = db.cfgdb.get_entry('VLAN', vlan_name) + if len(vlan) == 0: + ctx.fail("{} doesn't exist".format(vlan_name)) + + dhcp_relay_dests = vlan.get('dhcp_servers', []) + if not dhcp_relay_destination_ip in dhcp_relay_dests: + ctx.fail("{} is not a DHCP relay destination for {}".format(dhcp_relay_destination_ip, vlan_name)) + + dhcp_relay_dests.remove(dhcp_relay_destination_ip) + if len(dhcp_relay_dests) == 0: + del vlan['dhcp_servers'] + else: + vlan['dhcp_servers'] = dhcp_relay_dests + db.cfgdb.set_entry('VLAN', vlan_name, vlan) + click.echo("Removed DHCP relay destination address {} from {}".format(dhcp_relay_destination_ip, vlan_name)) + try: + click.echo("Restarting DHCP relay service...") + clicommon.run_command("systemctl stop dhcp_relay", display_cmd=False) + clicommon.run_command("systemctl reset-failed dhcp_relay", display_cmd=False) + clicommon.run_command("systemctl start dhcp_relay", display_cmd=False) + except SystemExit as e: + ctx.fail("Restart service dhcp_relay failed with error {}".format(e)) + + +def register(cli): + cli.commands['vlan'].add_command(vlan_dhcp_relay) + + +if __name__ == '__main__': + vlan_dhcp_relay() diff --git a/dockers/docker-dhcp-relay/cli/show/plugins/dhcp_relay.py b/dockers/docker-dhcp-relay/cli/show/plugins/dhcp_relay.py new file mode 100644 index 000000000000..a1240dc57a1d --- /dev/null +++ b/dockers/docker-dhcp-relay/cli/show/plugins/dhcp_relay.py @@ -0,0 +1,22 @@ +from natsort import natsorted +from .. import vlan + + +def get_dhcp_helper_address(ctx, vlan): + cfg, _ = ctx + vlan_dhcp_helper_data, _, _ = cfg + vlan_config = vlan_dhcp_helper_data.get(vlan) + if not vlan_config: + return "" + + dhcp_helpers = vlan_config.get('dhcp_servers', []) + + return '\n'.join(natsorted(dhcp_helpers)) + + +vlan.VlanBrief.COLUMNS.append(('DHCP Helper Address', get_dhcp_helper_address)) + + +def register(cli): + pass + diff --git a/dockers/docker-dhcp-relay/manifest.json.j2 b/dockers/docker-dhcp-relay/manifest.json.j2 index 11e5a832d39c..f290c220bad2 100644 --- a/dockers/docker-dhcp-relay/manifest.json.j2 +++ b/dockers/docker-dhcp-relay/manifest.json.j2 @@ -10,7 +10,34 @@ }, "service": { "name": "{{ name }}", + "requires": [ + "updategraph" + ], + "after": [ + "swss", + "syncd", + "teamd" + ], + "before": [ + "ntp-config" + ], + "dependent-of": ["swss"], "asic-service": false, "host-service": true + }, + "container": { + "privileged": true, + "volumes": [ + "/etc/sonic:/etc/sonic:ro", + "/usr/share/sonic/scripts:/usr/share/sonic/scripts:ro" + ], + "tmpfs": [ + "/tmp/", + "/var/tmp/" + ] + }, + "cli": { + "config": "/cli/config/plugins/dhcp_relay.py", + "show": "/cli/show/plugins/dhcp_relay.py" } } diff --git a/files/build_templates/init_cfg.json.j2 b/files/build_templates/init_cfg.json.j2 index 0cf85cd8ab06..bc45dd9a43a3 100644 --- a/files/build_templates/init_cfg.json.j2 +++ b/files/build_templates/init_cfg.json.j2 @@ -20,7 +20,6 @@ }, {%- set features = [("bgp", "enabled", false, "enabled"), ("database", "always_enabled", false, "always_enabled"), - ("dhcp_relay", "enabled", false, "enabled"), ("lldp", "enabled", false, "enabled"), ("pmon", "enabled", false, "enabled"), ("radv", "enabled", false, "enabled"), @@ -45,7 +44,7 @@ "has_per_asic_scope": {% if feature + '@.service' in installer_services.split(' ') %}true{% else %}false{% endif %}, "auto_restart": "{{autorestart}}", {%- if include_kubernetes == "y" %} -{%- if feature in ["dhcp_relay", "lldp", "pmon", "radv", "snmp", "telemetry"] %} +{%- if feature in ["lldp", "pmon", "radv", "snmp", "telemetry"] %} "set_owner": "kube", {% else %} "set_owner": "local", {% endif %} {% endif %} "high_mem_alert": "disabled" diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 83f342174350..8395bf9beed6 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -605,6 +605,28 @@ sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT docker pull k8s.gcr echo "docker images pull complete" {% endif %} +{% macro get_install_options(default_owner, enabled) -%} +{% set args = ["-y", "-v", "DEBUG"] -%} +{% if default_owner -%} +{% set args = args + ["--default-owner", default_owner] -%} +{% endif -%} +{% if enabled == "y" -%} +{% set args = args + ["--enabled"] -%} +{% endif -%} +{{ args | join(' ') }} +{% endmacro -%} + +{% for package in sonic_packages.strip().split() -%} +{% set name, repo, version, default_owner, enabled = package.split('|') -%} +sudo LANG=C chroot $FILESYSTEM_ROOT sonic-package-manager repository add {{ name }} {{ repo }} +sudo LANG=C chroot $FILESYSTEM_ROOT sonic-package-manager install {{ name }}=={{ version }} {{ get_install_options(default_owner, enabled) }} +{% endfor -%} + +{% for package in sonic_local_packages.strip().split() -%} +{% set name, path, default_owner, enabled = package.split('|') -%} +sudo LANG=C chroot $FILESYSTEM_ROOT sonic-package-manager install {{ path }} {{ get_install_options(default_owner, enabled) }} +{% endfor -%} + sudo umount $FILESYSTEM_ROOT/target sudo rm -r $FILESYSTEM_ROOT/target if [[ $CONFIGURED_ARCH == armhf || $CONFIGURED_ARCH == arm64 ]]; then diff --git a/files/scripts/swss.sh b/files/scripts/swss.sh index 1c54aefb0c0b..521d26f0ea77 100755 --- a/files/scripts/swss.sh +++ b/files/scripts/swss.sh @@ -1,8 +1,17 @@ #!/bin/bash -DEPENDENT="radv dhcp_relay" +DEPENDENT="radv" MULTI_INST_DEPENDENT="teamd" +# Update dependent list based on other packages requirements +if [[ -f /etc/sonic/${SERVICE}_dependent ]]; then + DEPENDENT="${DEPENDENT} $(cat /etc/sonic/${SERVICE}_dependent)" +fi + +if [[ -f /etc/sonic/${SERVICE}_multi_inst_dependent ]]; then + MULTI_INST_DEPENDENT="${MULTI_INST_DEPENDENT} cat /etc/sonic/${SERVICE}_multi_inst_dependent" +fi + function debug() { /usr/bin/logger $1 diff --git a/rules/config b/rules/config index 39eb786f2ff0..5a93064cf1ec 100644 --- a/rules/config +++ b/rules/config @@ -139,6 +139,9 @@ INCLUDE_RESTAPI = n # INCLUDE_NAT - build docker-nat for nat support INCLUDE_NAT = y +# INCLUDE_DHCP_RELAY - build and install dhcp-relay package +INCLUDE_DHCP_RELAY = y + # TELEMETRY_WRITABLE - Enable write/config operations via the gNMI interface. # Uncomment to enable: # TELEMETRY_WRITABLE = y diff --git a/rules/docker-dhcp-relay.mk b/rules/docker-dhcp-relay.mk index a4cb3573e462..bdde3afae0d6 100644 --- a/rules/docker-dhcp-relay.mk +++ b/rules/docker-dhcp-relay.mk @@ -19,13 +19,19 @@ $(DOCKER_DHCP_RELAY)_VERSION = 1.0.0 $(DOCKER_DHCP_RELAY)_PACKAGE_NAME = dhcp-relay SONIC_DOCKER_IMAGES += $(DOCKER_DHCP_RELAY) -SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_DHCP_RELAY) - SONIC_DOCKER_DBG_IMAGES += $(DOCKER_DHCP_RELAY_DBG) -SONIC_INSTALL_DOCKER_DBG_IMAGES += $(DOCKER_DHCP_RELAY_DBG) + +ifeq ($(INCLUDE_KUBERNETES),y) +$(DOCKER_DHCP_RELAY)_DEFAULT_FEATURE_OWNER = kube +endif + +$(DOCKER_DHCP_RELAY)_DEFAULT_FEATURE_STATE_ENABLED = y + +ifeq ($(INSTALL_DEBUG_TOOLS),y) +SONIC_PACKAGES_LOCAL += $(DOCKER_DHCP_RELAY_DBG) +else +SONIC_PACKAGES_LOCAL += $(DOCKER_DHCP_RELAY) +endif $(DOCKER_DHCP_RELAY)_CONTAINER_NAME = dhcp_relay -$(DOCKER_DHCP_RELAY)_RUN_OPT += --privileged -t -$(DOCKER_DHCP_RELAY)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro -$(DOCKER_DHCP_RELAY)_RUN_OPT += -v /usr/share/sonic/scripts:/usr/share/sonic/scripts:ro $(DOCKER_DHCP_RELAY)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT) diff --git a/rules/sonic-packages.mk b/rules/sonic-packages.mk new file mode 100644 index 000000000000..47e02001f93b --- /dev/null +++ b/rules/sonic-packages.mk @@ -0,0 +1,9 @@ +# rules to define remote packages that need to be installed +# during SONiC image build + +## Example: +## PACKAGE = my-package +## $(PACKAGE)_REPOSITORY = myrepo/mypackage +## $(PACKAGE)_VERSION = 1.0.0 +## SONIC_PACKAGES += $(PACKAGE) + diff --git a/slave.mk b/slave.mk index 362f4bd0560d..b57a44719a0e 100644 --- a/slave.mk +++ b/slave.mk @@ -251,6 +251,7 @@ $(info "INCLUDE_HOST_SERVICE" : "$(INCLUDE_HOST_SERVICE)") $(info "INCLUDE_RESTAPI" : "$(INCLUDE_RESTAPI)") $(info "INCLUDE_SFLOW" : "$(INCLUDE_SFLOW)") $(info "INCLUDE_NAT" : "$(INCLUDE_NAT)") +$(info "INCLUDE_DHCP_RELAY" : "$(INCLUDE_DHCP_RELAY)") $(info "INCLUDE_KUBERNETES" : "$(INCLUDE_KUBERNETES)") $(info "TELEMETRY_WRITABLE" : "$(TELEMETRY_WRITABLE)") $(info "PDDF_SUPPORT" : "$(PDDF_SUPPORT)") @@ -862,6 +863,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ $(SONIC_UTILITIES_DATA) \ $(SONIC_HOST_SERVICES_DATA)) \ $$(addprefix $(TARGET_PATH)/,$$($$*_DOCKERS)) \ + $$(addprefix $(TARGET_PATH)/,$$(SONIC_PACKAGES_LOCAL)) \ $$(addprefix $(FILES_PATH)/,$$($$*_FILES)) \ $(if $(findstring y,$(ENABLE_ZTP)),$(addprefix $(IMAGE_DISTRO_DEBS_PATH)/,$(SONIC_ZTP))) \ $(if $(findstring y,$(INCLUDE_HOST_SERVICE)),$(addprefix $(IMAGE_DISTRO_DEBS_PATH)/,$(SONIC_HOST_SERVICE))) \ @@ -913,8 +915,17 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ export lazy_installer_debs="$(foreach deb, $($*_LAZY_INSTALLS),$(foreach device, $($(deb)_PLATFORM),$(addprefix $(device)@, $(IMAGE_DISTRO_DEBS_PATH)/$(deb))))" export installer_images="$(foreach docker, $($*_DOCKERS),\ $(addprefix $($(docker)_PACKAGE_NAME)|,\ - $(addprefix $($(docker)_PATH)|,\ - $(addprefix $(TARGET_PATH)/,$(addsuffix :$($(docker)_VERSION),$(docker))))))" + $(addprefix $($(docker)_PATH)|,\ + $(addprefix $(TARGET_PATH)/,$(addsuffix :$($(docker)_VERSION),$(docker))))))" + export sonic_packages="$(foreach package, $(SONIC_PACKAGES),\ + $(addsuffix |$($(package)_DEFAULT_FEATURE_STATE_ENABLED),\ + $(addsuffix |$($(package)_DEFAULT_FEATURE_OWNER),\ + $(addsuffix |$($(package)_VERSION),\ + $(addsuffix |$($(package)_REPOSITORY), $(package))))))" + export sonic_local_packages="$(foreach package, $(SONIC_PACKAGES_LOCAL),\ + $(addsuffix |$($(package)_DEFAULT_FEATURE_STATE_ENABLED),\ + $(addsuffix |$($(package)_DEFAULT_FEATURE_OWNER) \ + $(addsuffix |$($(package)_PATH)), $(package))))" export sonic_py_common_py2_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_PY_COMMON_PY2))" export sonic_py_common_py3_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_PY_COMMON_PY3))" export config_engine_py2_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_CONFIG_ENGINE_PY2))" From efc69f5deaa042b6a0670f79fd2a609b21cdd2e3 Mon Sep 17 00:00:00 2001 From: Stepan Blyshchak Date: Wed, 20 Jan 2021 18:57:18 +0200 Subject: [PATCH 08/44] [slave.mk] align lines in dependencies Signed-off-by: Stepan Blyshchak --- slave.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slave.mk b/slave.mk index b57a44719a0e..86a3220585cd 100644 --- a/slave.mk +++ b/slave.mk @@ -863,7 +863,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ $(SONIC_UTILITIES_DATA) \ $(SONIC_HOST_SERVICES_DATA)) \ $$(addprefix $(TARGET_PATH)/,$$($$*_DOCKERS)) \ - $$(addprefix $(TARGET_PATH)/,$$(SONIC_PACKAGES_LOCAL)) \ + $$(addprefix $(TARGET_PATH)/,$$(SONIC_PACKAGES_LOCAL)) \ $$(addprefix $(FILES_PATH)/,$$($$*_FILES)) \ $(if $(findstring y,$(ENABLE_ZTP)),$(addprefix $(IMAGE_DISTRO_DEBS_PATH)/,$(SONIC_ZTP))) \ $(if $(findstring y,$(INCLUDE_HOST_SERVICE)),$(addprefix $(IMAGE_DISTRO_DEBS_PATH)/,$(SONIC_HOST_SERVICE))) \ From 823eeded6925c37bf3fe1f5fee6304a85bfee685 Mon Sep 17 00:00:00 2001 From: Stepan Blyshchak Date: Thu, 21 Jan 2021 13:09:08 +0200 Subject: [PATCH 09/44] [docker-macsec] add version number for docker-macsec Signed-off-by: Stepan Blyshchak --- rules/docker-macsec.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/rules/docker-macsec.mk b/rules/docker-macsec.mk index f9f8c9b41298..dbd5e698c4bb 100644 --- a/rules/docker-macsec.mk +++ b/rules/docker-macsec.mk @@ -24,6 +24,7 @@ SONIC_INSTALL_DOCKER_DBG_IMAGES += $(DOCKER_MACSEC_DBG) SONIC_BUSTER_DBG_DOCKERS += $(DOCKER_MACSEC_DBG) $(DOCKER_MACSEC)_CONTAINER_NAME = macsec +$(DOCKER_MACSEC)_VERSION = 1.0.0 $(DOCKER_MACSEC)_RUN_OPT += --privileged -t $(DOCKER_MACSEC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro $(DOCKER_MACSEC)_RUN_OPT += -v /host/warmboot:/var/warmboot From 05df4edee53d6893180cba0f1fbbd2eda90b4a20 Mon Sep 17 00:00:00 2001 From: Stepan Blyshchak Date: Thu, 21 Jan 2021 13:19:25 +0200 Subject: [PATCH 10/44] [docker-macsec] add manifest for macsec docker Signed-off-by: Stepan Blyshchak --- dockers/docker-macsec/Dockerfile.j2 | 3 +++ dockers/docker-macsec/manifest.json.j2 | 17 +++++++++++++++++ rules/docker-macsec.mk | 1 + 3 files changed, 21 insertions(+) create mode 100644 dockers/docker-macsec/manifest.json.j2 diff --git a/dockers/docker-macsec/Dockerfile.j2 b/dockers/docker-macsec/Dockerfile.j2 index bf8db48079e0..03f5bebab14d 100644 --- a/dockers/docker-macsec/Dockerfile.j2 +++ b/dockers/docker-macsec/Dockerfile.j2 @@ -2,6 +2,7 @@ FROM docker-config-engine-buster ARG docker_container_name +ARG manifest RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf ## Make apt-get non-interactive @@ -27,4 +28,6 @@ COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] COPY ["files/supervisor-proc-exit-listener", "/usr/bin"] COPY ["critical_processes", "/etc/supervisor"] +LABEL com.azure.sonic.manifest="$manifest" + # ENTRYPOINT ["/usr/bin/supervisord"] diff --git a/dockers/docker-macsec/manifest.json.j2 b/dockers/docker-macsec/manifest.json.j2 new file mode 100644 index 000000000000..e21b557a079d --- /dev/null +++ b/dockers/docker-macsec/manifest.json.j2 @@ -0,0 +1,17 @@ +{ + "version": "1.0.0", + "package": { + "version": "{{ version }}", + "base-os-contraint": "^1.0.0", + "depends": [ + "database^1.0.0", + "swss^1.0.0" + ], + "name": "{{ package_name }}" + }, + "service": { + "name": "{{ name }}", + "asic-service": true, + "host-service": false + } +} diff --git a/rules/docker-macsec.mk b/rules/docker-macsec.mk index dbd5e698c4bb..0e59b491a23a 100644 --- a/rules/docker-macsec.mk +++ b/rules/docker-macsec.mk @@ -25,6 +25,7 @@ SONIC_BUSTER_DBG_DOCKERS += $(DOCKER_MACSEC_DBG) $(DOCKER_MACSEC)_CONTAINER_NAME = macsec $(DOCKER_MACSEC)_VERSION = 1.0.0 +$(DOCKER_MACSEC)_PACKAGE_NAME = macsec $(DOCKER_MACSEC)_RUN_OPT += --privileged -t $(DOCKER_MACSEC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro $(DOCKER_MACSEC)_RUN_OPT += -v /host/warmboot:/var/warmboot From e966fefb8ea82b1cd189dbd34eedd556f4d44f37 Mon Sep 17 00:00:00 2001 From: Stepan Blyshchak Date: Thu, 21 Jan 2021 17:49:35 +0200 Subject: [PATCH 11/44] [slave.mk] fix missing comma Signed-off-by: Stepan Blyshchak --- slave.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slave.mk b/slave.mk index 86a3220585cd..f69a8f6dae3d 100644 --- a/slave.mk +++ b/slave.mk @@ -924,7 +924,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ $(addsuffix |$($(package)_REPOSITORY), $(package))))))" export sonic_local_packages="$(foreach package, $(SONIC_PACKAGES_LOCAL),\ $(addsuffix |$($(package)_DEFAULT_FEATURE_STATE_ENABLED),\ - $(addsuffix |$($(package)_DEFAULT_FEATURE_OWNER) \ + $(addsuffix |$($(package)_DEFAULT_FEATURE_OWNER), \ $(addsuffix |$($(package)_PATH)), $(package))))" export sonic_py_common_py2_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_PY_COMMON_PY2))" export sonic_py_common_py3_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_PY_COMMON_PY3))" From d79293e7696833e207b1a510288eb92adba49901 Mon Sep 17 00:00:00 2001 From: Stepan Blyshchak Date: Thu, 21 Jan 2021 17:52:05 +0200 Subject: [PATCH 12/44] [slave.mk] fix missing comma Signed-off-by: Stepan Blyshchak --- slave.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slave.mk b/slave.mk index f69a8f6dae3d..45fbeeb44691 100644 --- a/slave.mk +++ b/slave.mk @@ -924,7 +924,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ $(addsuffix |$($(package)_REPOSITORY), $(package))))))" export sonic_local_packages="$(foreach package, $(SONIC_PACKAGES_LOCAL),\ $(addsuffix |$($(package)_DEFAULT_FEATURE_STATE_ENABLED),\ - $(addsuffix |$($(package)_DEFAULT_FEATURE_OWNER), \ + $(addsuffix |$($(package)_DEFAULT_FEATURE_OWNER),\ $(addsuffix |$($(package)_PATH)), $(package))))" export sonic_py_common_py2_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_PY_COMMON_PY2))" export sonic_py_common_py3_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_PY_COMMON_PY3))" From a90f9b42823d8aec27a667e2a06ecb6c58bf947e Mon Sep 17 00:00:00 2001 From: Stepan Blyshchak Date: Thu, 21 Jan 2021 18:10:25 +0200 Subject: [PATCH 13/44] [slave.mk] fix missing comma Signed-off-by: Stepan Blyshchak --- slave.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slave.mk b/slave.mk index 45fbeeb44691..72765837dc27 100644 --- a/slave.mk +++ b/slave.mk @@ -925,7 +925,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ export sonic_local_packages="$(foreach package, $(SONIC_PACKAGES_LOCAL),\ $(addsuffix |$($(package)_DEFAULT_FEATURE_STATE_ENABLED),\ $(addsuffix |$($(package)_DEFAULT_FEATURE_OWNER),\ - $(addsuffix |$($(package)_PATH)), $(package))))" + $(addsuffix |$($(package)_PATH), $(package)))))" export sonic_py_common_py2_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_PY_COMMON_PY2))" export sonic_py_common_py3_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_PY_COMMON_PY3))" export config_engine_py2_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_CONFIG_ENGINE_PY2))" From 74cd8759f3da2441194d7456cd164608d900f342 Mon Sep 17 00:00:00 2001 From: Stepan Blyshchak Date: Thu, 21 Jan 2021 18:43:29 +0200 Subject: [PATCH 14/44] [sonic_debian_extension.j2] use --enable instead of --enabled Signed-off-by: Stepan Blyshchak --- files/build_templates/sonic_debian_extension.j2 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 8395bf9beed6..f56f25497327 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -393,7 +393,7 @@ sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install watchd {% if include_kubernetes == "y" %} # Install remote Container mgmt package -# Required even if include_kubernetes != y, as it contains the +# Required even if include_kubernetes != y, as it contains the # the container wrapper for docker start/stop/wait commands. # SONIC_CTRMGMT_WHEEL_NAME=$(basename {{sonic_ctrmgmt_py3_wheel_path}}) @@ -417,7 +417,7 @@ sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable ctrmgrd.service # kubelet service is controlled by ctrmgrd daemon. sudo LANG=C chroot $FILESYSTEM_ROOT systemctl disable kubelet.service {% else %} -# container script for docker commands, which is required as +# container script for docker commands, which is required as # all docker commands are replaced with container commands. # So just copy that file only. # @@ -611,7 +611,7 @@ echo "docker images pull complete" {% set args = args + ["--default-owner", default_owner] -%} {% endif -%} {% if enabled == "y" -%} -{% set args = args + ["--enabled"] -%} +{% set args = args + ["--enable"] -%} {% endif -%} {{ args | join(' ') }} {% endmacro -%} @@ -619,12 +619,12 @@ echo "docker images pull complete" {% for package in sonic_packages.strip().split() -%} {% set name, repo, version, default_owner, enabled = package.split('|') -%} sudo LANG=C chroot $FILESYSTEM_ROOT sonic-package-manager repository add {{ name }} {{ repo }} -sudo LANG=C chroot $FILESYSTEM_ROOT sonic-package-manager install {{ name }}=={{ version }} {{ get_install_options(default_owner, enabled) }} +sudo LANG=C chroot $FILESYSTEM_ROOT sonic-package-manager install {{ name }}=={{ version }} {{ get_install_options(default_owner, enabled) }} {% endfor -%} {% for package in sonic_local_packages.strip().split() -%} {% set name, path, default_owner, enabled = package.split('|') -%} -sudo LANG=C chroot $FILESYSTEM_ROOT sonic-package-manager install {{ path }} {{ get_install_options(default_owner, enabled) }} +sudo LANG=C chroot $FILESYSTEM_ROOT sonic-package-manager install {{ path }} {{ get_install_options(default_owner, enabled) }} {% endfor -%} sudo umount $FILESYSTEM_ROOT/target From 2e5f097f0e3f1bd0c1e71e135081e5f2f41b40aa Mon Sep 17 00:00:00 2001 From: Stepan Blyshchak Date: Thu, 21 Jan 2021 19:11:55 +0200 Subject: [PATCH 15/44] [slave.mk] fix target path Signed-off-by: Stepan Blyshchak --- slave.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slave.mk b/slave.mk index 72765837dc27..af1efe6987c6 100644 --- a/slave.mk +++ b/slave.mk @@ -925,7 +925,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ export sonic_local_packages="$(foreach package, $(SONIC_PACKAGES_LOCAL),\ $(addsuffix |$($(package)_DEFAULT_FEATURE_STATE_ENABLED),\ $(addsuffix |$($(package)_DEFAULT_FEATURE_OWNER),\ - $(addsuffix |$($(package)_PATH), $(package)))))" + $(addsuffix |$(addprefix $(TARGET_PATH)/, $(package)), $(package)))))" export sonic_py_common_py2_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_PY_COMMON_PY2))" export sonic_py_common_py3_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_PY_COMMON_PY3))" export config_engine_py2_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_CONFIG_ENGINE_PY2))" From e1b2c29c51f445f5f4f9143033cd8d0ff6d543b1 Mon Sep 17 00:00:00 2001 From: Stepan Blyshchak Date: Thu, 21 Jan 2021 19:39:07 +0200 Subject: [PATCH 16/44] [docker-dhcp-relay] add cli to docker Signed-off-by: Stepan Blyshchak --- dockers/docker-dhcp-relay/Dockerfile.j2 | 1 + 1 file changed, 1 insertion(+) diff --git a/dockers/docker-dhcp-relay/Dockerfile.j2 b/dockers/docker-dhcp-relay/Dockerfile.j2 index d7de3016b6f0..396cd6abeb22 100644 --- a/dockers/docker-dhcp-relay/Dockerfile.j2 +++ b/dockers/docker-dhcp-relay/Dockerfile.j2 @@ -34,6 +34,7 @@ COPY ["docker_init.sh", "start.sh", "/usr/bin/"] COPY ["docker-dhcp-relay.supervisord.conf.j2", "port-name-alias-map.txt.j2", "wait_for_intf.sh.j2", "/usr/share/sonic/templates/"] COPY ["files/supervisor-proc-exit-listener", "/usr/bin"] COPY ["critical_processes", "/etc/supervisor"] +COPY ["cli", "/"] LABEL com.azure.sonic.manifest="$manifest" From db7ef7ded216c8a3add399a65a6043615771b476 Mon Sep 17 00:00:00 2001 From: Stepan Blyshchak Date: Thu, 21 Jan 2021 19:46:52 +0200 Subject: [PATCH 17/44] [docker-dhcp-relay] add cli to docker Signed-off-by: Stepan Blyshchak --- dockers/docker-dhcp-relay/Dockerfile.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockers/docker-dhcp-relay/Dockerfile.j2 b/dockers/docker-dhcp-relay/Dockerfile.j2 index 396cd6abeb22..c2b1e51f352a 100644 --- a/dockers/docker-dhcp-relay/Dockerfile.j2 +++ b/dockers/docker-dhcp-relay/Dockerfile.j2 @@ -34,7 +34,7 @@ COPY ["docker_init.sh", "start.sh", "/usr/bin/"] COPY ["docker-dhcp-relay.supervisord.conf.j2", "port-name-alias-map.txt.j2", "wait_for_intf.sh.j2", "/usr/share/sonic/templates/"] COPY ["files/supervisor-proc-exit-listener", "/usr/bin"] COPY ["critical_processes", "/etc/supervisor"] -COPY ["cli", "/"] +COPY ["cli", "/cli/"] LABEL com.azure.sonic.manifest="$manifest" From e0735d2703598831b6f5aed97d0a05f7f8e52089 Mon Sep 17 00:00:00 2001 From: Stepan Blyshchak Date: Mon, 25 Jan 2021 18:33:40 +0200 Subject: [PATCH 18/44] [sonic_debian_extension.j2] fix merge conflict markers Signed-off-by: Stepan Blyshchak --- files/build_templates/sonic_debian_extension.j2 | 4 ---- 1 file changed, 4 deletions(-) diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index f7669ff71b7f..83f342174350 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -578,13 +578,9 @@ sudo mount proc /proc -t proc sudo mkdir $FILESYSTEM_ROOT/target sudo mount --bind target $FILESYSTEM_ROOT/target sudo chroot $FILESYSTEM_ROOT docker $SONIC_NATIVE_DOCKERD_FOR_DOCKERFS info -<<<<<<< HEAD {% for docker_installation_target in installer_images.strip().split() -%} {% set pkgname, docker_build_path, image = docker_installation_target.split('|') %} -======= -{% for image in installer_images.strip().split(' ') -%} ->>>>>>> 823eeded6925c37bf3fe1f5fee6304a85bfee685 {% set imagefilepath = image.split(':')|first -%} {% set imageversion = image.split(':')|last -%} {% set imagefilename = imagefilepath.split('/')|last -%} From 489700347d4e23d6cdeeae521b4cca8c8b3823d3 Mon Sep 17 00:00:00 2001 From: Stepan Blyshchak Date: Thu, 28 Jan 2021 16:51:05 +0200 Subject: [PATCH 19/44] align install from tarball command Signed-off-by: Stepan Blyshchak --- files/build_templates/sonic_debian_extension.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index f56f25497327..1daa214709dc 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -624,7 +624,7 @@ sudo LANG=C chroot $FILESYSTEM_ROOT sonic-package-manager install {{ name }}=={{ {% for package in sonic_local_packages.strip().split() -%} {% set name, path, default_owner, enabled = package.split('|') -%} -sudo LANG=C chroot $FILESYSTEM_ROOT sonic-package-manager install {{ path }} {{ get_install_options(default_owner, enabled) }} +sudo LANG=C chroot $FILESYSTEM_ROOT sonic-package-manager install --from-tarball {{ path }} {{ get_install_options(default_owner, enabled) }} {% endfor -%} sudo umount $FILESYSTEM_ROOT/target From 2066aa964fe57fd3b25357f81b07dda77c4b0c0b Mon Sep 17 00:00:00 2001 From: Stepan Blyschak Date: Fri, 29 Jan 2021 12:54:14 +0000 Subject: [PATCH 20/44] [dockers] use single manifest template Signed-off-by: Stepan Blyshchak --- .gitignore | 5 ++++ dockers/docker-database/manifest.json.j2 | 13 --------- dockers/docker-dhcp-relay/manifest.json.j2 | 16 ----------- dockers/docker-fpm-frr/manifest.json.j2 | 21 --------------- dockers/docker-fpm-gobgp/manifest.json.j2 | 21 --------------- dockers/docker-fpm-quagga/manifest.json.j2 | 21 --------------- dockers/docker-iccpd/manifest.json.j2 | 17 ------------ dockers/docker-lldp/manifest.json.j2 | 17 ------------ dockers/docker-macsec/manifest.json.j2 | 17 ------------ dockers/docker-nat/manifest.json.j2 | 17 ------------ dockers/docker-orchagent/manifest.json.j2 | 17 ------------ .../docker-platform-monitor/manifest.json.j2 | 16 ----------- .../docker-router-advertiser/manifest.json.j2 | 16 ----------- dockers/docker-sflow/manifest.json.j2 | 17 ------------ dockers/docker-snmp/manifest.json.j2 | 17 ------------ .../manifest.json.j2 | 17 ------------ dockers/docker-sonic-restapi/manifest.json.j2 | 17 ------------ .../docker-sonic-telemetry/manifest.json.j2 | 17 ------------ dockers/docker-teamd/manifest.json.j2 | 17 ------------ files/build_templates/manifest.json.j2 | 27 +++++++++++++++++++ .../docker-syncd-bfn/manifest.json.j2 | 1 - .../docker-syncd-brcm/manifest.json.j2 | 1 - .../cavium/docker-syncd-cavm/manifest.json.j2 | 1 - .../docker-syncd-centec/manifest.json.j2 | 1 - .../docker-syncd-centec/manifest.json.j2 | 1 - .../docker-syncd-invm/manifest.json.j2 | 1 - .../docker-syncd-mrvl/manifest.json.j2 | 1 - .../docker-syncd-mrvl/manifest.json.j2 | 1 - .../docker-syncd-mrvl/manifest.json.j2 | 1 - .../docker-syncd-mlnx/manifest.json.j2 | 1 - .../docker-syncd-nephos/manifest.json.j2 | 1 - .../vs/docker-gbsyncd-vs/manifest.json.j2 | 1 - platform/vs/docker-syncd-vs/manifest.json.j2 | 1 - scripts/j2cli/json_filter.py | 12 +++++++++ slave.mk | 25 ++++++++++++----- 35 files changed, 62 insertions(+), 331 deletions(-) delete mode 100644 dockers/docker-database/manifest.json.j2 delete mode 100644 dockers/docker-dhcp-relay/manifest.json.j2 delete mode 100644 dockers/docker-fpm-frr/manifest.json.j2 delete mode 100644 dockers/docker-fpm-gobgp/manifest.json.j2 delete mode 100644 dockers/docker-fpm-quagga/manifest.json.j2 delete mode 100644 dockers/docker-iccpd/manifest.json.j2 delete mode 100644 dockers/docker-lldp/manifest.json.j2 delete mode 100644 dockers/docker-macsec/manifest.json.j2 delete mode 100644 dockers/docker-nat/manifest.json.j2 delete mode 100644 dockers/docker-orchagent/manifest.json.j2 delete mode 100644 dockers/docker-platform-monitor/manifest.json.j2 delete mode 100644 dockers/docker-router-advertiser/manifest.json.j2 delete mode 100644 dockers/docker-sflow/manifest.json.j2 delete mode 100644 dockers/docker-snmp/manifest.json.j2 delete mode 100644 dockers/docker-sonic-mgmt-framework/manifest.json.j2 delete mode 100644 dockers/docker-sonic-restapi/manifest.json.j2 delete mode 100644 dockers/docker-sonic-telemetry/manifest.json.j2 delete mode 100644 dockers/docker-teamd/manifest.json.j2 create mode 100644 files/build_templates/manifest.json.j2 delete mode 120000 platform/barefoot/docker-syncd-bfn/manifest.json.j2 delete mode 120000 platform/broadcom/docker-syncd-brcm/manifest.json.j2 delete mode 120000 platform/cavium/docker-syncd-cavm/manifest.json.j2 delete mode 120000 platform/centec-arm64/docker-syncd-centec/manifest.json.j2 delete mode 120000 platform/centec/docker-syncd-centec/manifest.json.j2 delete mode 120000 platform/innovium/docker-syncd-invm/manifest.json.j2 delete mode 120000 platform/marvell-arm64/docker-syncd-mrvl/manifest.json.j2 delete mode 120000 platform/marvell-armhf/docker-syncd-mrvl/manifest.json.j2 delete mode 120000 platform/marvell/docker-syncd-mrvl/manifest.json.j2 delete mode 120000 platform/mellanox/docker-syncd-mlnx/manifest.json.j2 delete mode 120000 platform/nephos/docker-syncd-nephos/manifest.json.j2 delete mode 120000 platform/vs/docker-gbsyncd-vs/manifest.json.j2 delete mode 120000 platform/vs/docker-syncd-vs/manifest.json.j2 create mode 100644 scripts/j2cli/json_filter.py diff --git a/.gitignore b/.gitignore index 7e2f73f718e9..6f7da6d22f22 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,7 @@ target/ *-dbg *dbg.j2 *.img +*.pyc # Autogenerated Dockerfiles sonic-slave*/Dockerfile @@ -27,6 +28,10 @@ sonic-slave*/Dockerfile.user dockers/*/Dockerfile platform/*/docker-*/Dockerfile +# Autogenerated manifest files +dockers/*/manifest.json +platform/*/docker-*/manifest.json + # Installer-related files and directories installer/x86_64/platforms/ diff --git a/dockers/docker-database/manifest.json.j2 b/dockers/docker-database/manifest.json.j2 deleted file mode 100644 index c08f7acfb849..000000000000 --- a/dockers/docker-database/manifest.json.j2 +++ /dev/null @@ -1,13 +0,0 @@ -{ - "version": "1.0.0", - "package": { - "version": "{{ version }}", - "base-os-contraint": "^1.0.0", - "name": "{{ package_name }}" - }, - "service": { - "name": "{{ name }}", - "asic-service": true, - "host-service": true - } -} diff --git a/dockers/docker-dhcp-relay/manifest.json.j2 b/dockers/docker-dhcp-relay/manifest.json.j2 deleted file mode 100644 index 11e5a832d39c..000000000000 --- a/dockers/docker-dhcp-relay/manifest.json.j2 +++ /dev/null @@ -1,16 +0,0 @@ -{ - "version": "1.0.0", - "package": { - "version": "{{ version }}", - "base-os-contraint": "^1.0.0", - "depends": [ - "database^1.0.0" - ], - "name": "{{ package_name }}" - }, - "service": { - "name": "{{ name }}", - "asic-service": false, - "host-service": true - } -} diff --git a/dockers/docker-fpm-frr/manifest.json.j2 b/dockers/docker-fpm-frr/manifest.json.j2 deleted file mode 100644 index dfc63fca1a6d..000000000000 --- a/dockers/docker-fpm-frr/manifest.json.j2 +++ /dev/null @@ -1,21 +0,0 @@ -{ - "version": "1.0.0", - "package": { - "version": "{{ version }}", - "base-os-contraint": "^1.0.0", - "depends": [ - "database^1.0.0", - "swss^1.0.0" - ], - "conflicts": [ - "fpm-gobgp", - "fpm-quagga" - ], - "name": "{{ package_name }}" - }, - "service": { - "name": "{{ name }}", - "asic-service": true, - "host-service": false - } -} diff --git a/dockers/docker-fpm-gobgp/manifest.json.j2 b/dockers/docker-fpm-gobgp/manifest.json.j2 deleted file mode 100644 index 982772f1aafa..000000000000 --- a/dockers/docker-fpm-gobgp/manifest.json.j2 +++ /dev/null @@ -1,21 +0,0 @@ -{ - "version": "1.0.0", - "package": { - "version": "{{ version }}", - "base-os-contraint": "^1.0.0", - "depends": [ - "database^1.0.0", - "swss^1.0.0" - ], - "conflicts": [ - "fpm-frr", - "fpm-quagga" - ], - "name": "{{ package_name }}" - }, - "service": { - "name": "{{ name }}", - "asic-service": true, - "host-service": false - } -} diff --git a/dockers/docker-fpm-quagga/manifest.json.j2 b/dockers/docker-fpm-quagga/manifest.json.j2 deleted file mode 100644 index 1f2daf816ea6..000000000000 --- a/dockers/docker-fpm-quagga/manifest.json.j2 +++ /dev/null @@ -1,21 +0,0 @@ -{ - "version": "1.0.0", - "package": { - "version": "{{ version }}", - "base-os-contraint": "^1.0.0", - "depends": [ - "database^1.0.0", - "swss^1.0.0" - ], - "conflicts": [ - "fpm-gobgp", - "fpm-frr" - ], - "name": "{{ package_name }}" - }, - "service": { - "name": "{{ name }}", - "asic-service": true, - "host-service": false - } -} diff --git a/dockers/docker-iccpd/manifest.json.j2 b/dockers/docker-iccpd/manifest.json.j2 deleted file mode 100644 index bbce95399868..000000000000 --- a/dockers/docker-iccpd/manifest.json.j2 +++ /dev/null @@ -1,17 +0,0 @@ -{ - "version": "1.0.0", - "package": { - "version": "{{ version }}", - "base-os-contraint": "^1.0.0", - "depends": [ - "database^1.0.0", - "swss^1.0.0" - ], - "name": "{{ package_name }}" - }, - "service": { - "name": "{{ name }}", - "asic-service": false, - "host-service": true - } -} diff --git a/dockers/docker-lldp/manifest.json.j2 b/dockers/docker-lldp/manifest.json.j2 deleted file mode 100644 index d1edab0d4d98..000000000000 --- a/dockers/docker-lldp/manifest.json.j2 +++ /dev/null @@ -1,17 +0,0 @@ -{ - "version": "1.0.0", - "package": { - "version": "{{ version }}", - "base-os-contraint": "^1.0.0", - "depends": [ - "database^1.0.0", - "swss^1.0.0" - ], - "name": "{{ package_name }}" - }, - "service": { - "name": "{{ name }}", - "asic-service": true, - "host-service": true - } -} diff --git a/dockers/docker-macsec/manifest.json.j2 b/dockers/docker-macsec/manifest.json.j2 deleted file mode 100644 index e21b557a079d..000000000000 --- a/dockers/docker-macsec/manifest.json.j2 +++ /dev/null @@ -1,17 +0,0 @@ -{ - "version": "1.0.0", - "package": { - "version": "{{ version }}", - "base-os-contraint": "^1.0.0", - "depends": [ - "database^1.0.0", - "swss^1.0.0" - ], - "name": "{{ package_name }}" - }, - "service": { - "name": "{{ name }}", - "asic-service": true, - "host-service": false - } -} diff --git a/dockers/docker-nat/manifest.json.j2 b/dockers/docker-nat/manifest.json.j2 deleted file mode 100644 index bbce95399868..000000000000 --- a/dockers/docker-nat/manifest.json.j2 +++ /dev/null @@ -1,17 +0,0 @@ -{ - "version": "1.0.0", - "package": { - "version": "{{ version }}", - "base-os-contraint": "^1.0.0", - "depends": [ - "database^1.0.0", - "swss^1.0.0" - ], - "name": "{{ package_name }}" - }, - "service": { - "name": "{{ name }}", - "asic-service": false, - "host-service": true - } -} diff --git a/dockers/docker-orchagent/manifest.json.j2 b/dockers/docker-orchagent/manifest.json.j2 deleted file mode 100644 index ac3d07d87564..000000000000 --- a/dockers/docker-orchagent/manifest.json.j2 +++ /dev/null @@ -1,17 +0,0 @@ -{ - "version": "1.0.0", - "package": { - "version": "{{ version }}", - "base-os-contraint": "^1.0.0", - "depends": [ - "database^1.0.0", - "syncd^1.0.0" - ], - "name": "{{ package_name }}" - }, - "service": { - "name": "{{ name }}", - "asic-service": true, - "host-service": false - } -} diff --git a/dockers/docker-platform-monitor/manifest.json.j2 b/dockers/docker-platform-monitor/manifest.json.j2 deleted file mode 100644 index 11e5a832d39c..000000000000 --- a/dockers/docker-platform-monitor/manifest.json.j2 +++ /dev/null @@ -1,16 +0,0 @@ -{ - "version": "1.0.0", - "package": { - "version": "{{ version }}", - "base-os-contraint": "^1.0.0", - "depends": [ - "database^1.0.0" - ], - "name": "{{ package_name }}" - }, - "service": { - "name": "{{ name }}", - "asic-service": false, - "host-service": true - } -} diff --git a/dockers/docker-router-advertiser/manifest.json.j2 b/dockers/docker-router-advertiser/manifest.json.j2 deleted file mode 100644 index 11e5a832d39c..000000000000 --- a/dockers/docker-router-advertiser/manifest.json.j2 +++ /dev/null @@ -1,16 +0,0 @@ -{ - "version": "1.0.0", - "package": { - "version": "{{ version }}", - "base-os-contraint": "^1.0.0", - "depends": [ - "database^1.0.0" - ], - "name": "{{ package_name }}" - }, - "service": { - "name": "{{ name }}", - "asic-service": false, - "host-service": true - } -} diff --git a/dockers/docker-sflow/manifest.json.j2 b/dockers/docker-sflow/manifest.json.j2 deleted file mode 100644 index bbce95399868..000000000000 --- a/dockers/docker-sflow/manifest.json.j2 +++ /dev/null @@ -1,17 +0,0 @@ -{ - "version": "1.0.0", - "package": { - "version": "{{ version }}", - "base-os-contraint": "^1.0.0", - "depends": [ - "database^1.0.0", - "swss^1.0.0" - ], - "name": "{{ package_name }}" - }, - "service": { - "name": "{{ name }}", - "asic-service": false, - "host-service": true - } -} diff --git a/dockers/docker-snmp/manifest.json.j2 b/dockers/docker-snmp/manifest.json.j2 deleted file mode 100644 index bbce95399868..000000000000 --- a/dockers/docker-snmp/manifest.json.j2 +++ /dev/null @@ -1,17 +0,0 @@ -{ - "version": "1.0.0", - "package": { - "version": "{{ version }}", - "base-os-contraint": "^1.0.0", - "depends": [ - "database^1.0.0", - "swss^1.0.0" - ], - "name": "{{ package_name }}" - }, - "service": { - "name": "{{ name }}", - "asic-service": false, - "host-service": true - } -} diff --git a/dockers/docker-sonic-mgmt-framework/manifest.json.j2 b/dockers/docker-sonic-mgmt-framework/manifest.json.j2 deleted file mode 100644 index bbce95399868..000000000000 --- a/dockers/docker-sonic-mgmt-framework/manifest.json.j2 +++ /dev/null @@ -1,17 +0,0 @@ -{ - "version": "1.0.0", - "package": { - "version": "{{ version }}", - "base-os-contraint": "^1.0.0", - "depends": [ - "database^1.0.0", - "swss^1.0.0" - ], - "name": "{{ package_name }}" - }, - "service": { - "name": "{{ name }}", - "asic-service": false, - "host-service": true - } -} diff --git a/dockers/docker-sonic-restapi/manifest.json.j2 b/dockers/docker-sonic-restapi/manifest.json.j2 deleted file mode 100644 index bbce95399868..000000000000 --- a/dockers/docker-sonic-restapi/manifest.json.j2 +++ /dev/null @@ -1,17 +0,0 @@ -{ - "version": "1.0.0", - "package": { - "version": "{{ version }}", - "base-os-contraint": "^1.0.0", - "depends": [ - "database^1.0.0", - "swss^1.0.0" - ], - "name": "{{ package_name }}" - }, - "service": { - "name": "{{ name }}", - "asic-service": false, - "host-service": true - } -} diff --git a/dockers/docker-sonic-telemetry/manifest.json.j2 b/dockers/docker-sonic-telemetry/manifest.json.j2 deleted file mode 100644 index bbce95399868..000000000000 --- a/dockers/docker-sonic-telemetry/manifest.json.j2 +++ /dev/null @@ -1,17 +0,0 @@ -{ - "version": "1.0.0", - "package": { - "version": "{{ version }}", - "base-os-contraint": "^1.0.0", - "depends": [ - "database^1.0.0", - "swss^1.0.0" - ], - "name": "{{ package_name }}" - }, - "service": { - "name": "{{ name }}", - "asic-service": false, - "host-service": true - } -} diff --git a/dockers/docker-teamd/manifest.json.j2 b/dockers/docker-teamd/manifest.json.j2 deleted file mode 100644 index e21b557a079d..000000000000 --- a/dockers/docker-teamd/manifest.json.j2 +++ /dev/null @@ -1,17 +0,0 @@ -{ - "version": "1.0.0", - "package": { - "version": "{{ version }}", - "base-os-contraint": "^1.0.0", - "depends": [ - "database^1.0.0", - "swss^1.0.0" - ], - "name": "{{ package_name }}" - }, - "service": { - "name": "{{ name }}", - "asic-service": true, - "host-service": false - } -} diff --git a/files/build_templates/manifest.json.j2 b/files/build_templates/manifest.json.j2 new file mode 100644 index 000000000000..51bf5a0b270a --- /dev/null +++ b/files/build_templates/manifest.json.j2 @@ -0,0 +1,27 @@ +{ + "version": "1.0.0", + "package": { + "version": "{{ version }}", + "base-os-contraint": "^{{ base_os_ver.split('.')[0] }}.0.0", + "depends": {{ depends.split()|json if depends is defined else []}}, + "name": "{{ package_name }}" + }, + "service": { + "name": "{{ name }}", + "requires": {{ requires.split()|json if requires is defined else [] }}, + "after": {{ after.split()|json if after is defined else [] }}, + "before": {{ before.split()|json if before is defined else [] }}, + "dependent-of": {{ dependent_of.split()|json if dependent_of is defined else [] }}, + "asic-service": {{ asic_service }}, + "host-service": {{ host_service }} + }, + "container": { + "privileged": {{ privileged if privileged else 'false' }}, + "volumes": {{ volumes.split()|json if volumes is defined else [] }}, + "tmpfs": {{ tmpfs.split()|json if tmpfs is defined else [] }} + }, + "cli": { + "config": "{{ config_cli_plugin|default('') }}", + "show": "{{ show_cli_plugin|default('') }}" + } +} diff --git a/platform/barefoot/docker-syncd-bfn/manifest.json.j2 b/platform/barefoot/docker-syncd-bfn/manifest.json.j2 deleted file mode 120000 index affca28ad9a9..000000000000 --- a/platform/barefoot/docker-syncd-bfn/manifest.json.j2 +++ /dev/null @@ -1 +0,0 @@ -../../template/manifest.json.j2 \ No newline at end of file diff --git a/platform/broadcom/docker-syncd-brcm/manifest.json.j2 b/platform/broadcom/docker-syncd-brcm/manifest.json.j2 deleted file mode 120000 index affca28ad9a9..000000000000 --- a/platform/broadcom/docker-syncd-brcm/manifest.json.j2 +++ /dev/null @@ -1 +0,0 @@ -../../template/manifest.json.j2 \ No newline at end of file diff --git a/platform/cavium/docker-syncd-cavm/manifest.json.j2 b/platform/cavium/docker-syncd-cavm/manifest.json.j2 deleted file mode 120000 index affca28ad9a9..000000000000 --- a/platform/cavium/docker-syncd-cavm/manifest.json.j2 +++ /dev/null @@ -1 +0,0 @@ -../../template/manifest.json.j2 \ No newline at end of file diff --git a/platform/centec-arm64/docker-syncd-centec/manifest.json.j2 b/platform/centec-arm64/docker-syncd-centec/manifest.json.j2 deleted file mode 120000 index affca28ad9a9..000000000000 --- a/platform/centec-arm64/docker-syncd-centec/manifest.json.j2 +++ /dev/null @@ -1 +0,0 @@ -../../template/manifest.json.j2 \ No newline at end of file diff --git a/platform/centec/docker-syncd-centec/manifest.json.j2 b/platform/centec/docker-syncd-centec/manifest.json.j2 deleted file mode 120000 index affca28ad9a9..000000000000 --- a/platform/centec/docker-syncd-centec/manifest.json.j2 +++ /dev/null @@ -1 +0,0 @@ -../../template/manifest.json.j2 \ No newline at end of file diff --git a/platform/innovium/docker-syncd-invm/manifest.json.j2 b/platform/innovium/docker-syncd-invm/manifest.json.j2 deleted file mode 120000 index affca28ad9a9..000000000000 --- a/platform/innovium/docker-syncd-invm/manifest.json.j2 +++ /dev/null @@ -1 +0,0 @@ -../../template/manifest.json.j2 \ No newline at end of file diff --git a/platform/marvell-arm64/docker-syncd-mrvl/manifest.json.j2 b/platform/marvell-arm64/docker-syncd-mrvl/manifest.json.j2 deleted file mode 120000 index affca28ad9a9..000000000000 --- a/platform/marvell-arm64/docker-syncd-mrvl/manifest.json.j2 +++ /dev/null @@ -1 +0,0 @@ -../../template/manifest.json.j2 \ No newline at end of file diff --git a/platform/marvell-armhf/docker-syncd-mrvl/manifest.json.j2 b/platform/marvell-armhf/docker-syncd-mrvl/manifest.json.j2 deleted file mode 120000 index affca28ad9a9..000000000000 --- a/platform/marvell-armhf/docker-syncd-mrvl/manifest.json.j2 +++ /dev/null @@ -1 +0,0 @@ -../../template/manifest.json.j2 \ No newline at end of file diff --git a/platform/marvell/docker-syncd-mrvl/manifest.json.j2 b/platform/marvell/docker-syncd-mrvl/manifest.json.j2 deleted file mode 120000 index affca28ad9a9..000000000000 --- a/platform/marvell/docker-syncd-mrvl/manifest.json.j2 +++ /dev/null @@ -1 +0,0 @@ -../../template/manifest.json.j2 \ No newline at end of file diff --git a/platform/mellanox/docker-syncd-mlnx/manifest.json.j2 b/platform/mellanox/docker-syncd-mlnx/manifest.json.j2 deleted file mode 120000 index affca28ad9a9..000000000000 --- a/platform/mellanox/docker-syncd-mlnx/manifest.json.j2 +++ /dev/null @@ -1 +0,0 @@ -../../template/manifest.json.j2 \ No newline at end of file diff --git a/platform/nephos/docker-syncd-nephos/manifest.json.j2 b/platform/nephos/docker-syncd-nephos/manifest.json.j2 deleted file mode 120000 index affca28ad9a9..000000000000 --- a/platform/nephos/docker-syncd-nephos/manifest.json.j2 +++ /dev/null @@ -1 +0,0 @@ -../../template/manifest.json.j2 \ No newline at end of file diff --git a/platform/vs/docker-gbsyncd-vs/manifest.json.j2 b/platform/vs/docker-gbsyncd-vs/manifest.json.j2 deleted file mode 120000 index affca28ad9a9..000000000000 --- a/platform/vs/docker-gbsyncd-vs/manifest.json.j2 +++ /dev/null @@ -1 +0,0 @@ -../../template/manifest.json.j2 \ No newline at end of file diff --git a/platform/vs/docker-syncd-vs/manifest.json.j2 b/platform/vs/docker-syncd-vs/manifest.json.j2 deleted file mode 120000 index affca28ad9a9..000000000000 --- a/platform/vs/docker-syncd-vs/manifest.json.j2 +++ /dev/null @@ -1 +0,0 @@ -../../template/manifest.json.j2 \ No newline at end of file diff --git a/scripts/j2cli/json_filter.py b/scripts/j2cli/json_filter.py new file mode 100644 index 000000000000..62b35ab22dc3 --- /dev/null +++ b/scripts/j2cli/json_filter.py @@ -0,0 +1,12 @@ +import json + + +def extra_filters(): + """ Declare some custom filters. + + Returns: dict(name = function) + """ + return dict( + json=json.dumps, + ) + diff --git a/slave.mk b/slave.mk index 362f4bd0560d..d0adbdc2f5a6 100644 --- a/slave.mk +++ b/slave.mk @@ -737,7 +737,24 @@ $(addprefix $(TARGET_PATH)/, $(DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .platform $(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_pydebs=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_PYTHON_DEBS)))\n" | awk '!a[$$0]++')) $(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_whls=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_PYTHON_WHEELS)))\n" | awk '!a[$$0]++')) $(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_dbgs=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_DBG_PACKAGES)))\n" | awk '!a[$$0]++')) + $(eval export version=$($*.gz_VERSION)) + $(eval export name=$($*.gz_CONTAINER_NAME)) + $(eval export package_name=$($*.gz_PACKAGE_NAME)) + $(eval export base_os_ver=$(BASE_OS_COMPATIBILITY_VERSION)) + $(eval export asic_service=$(shell [ -f files/build_templates/per_namespace/$(name).service.j2 ] && echo true || echo false)) + $(eval export host_service=$(shell [ -f files/build_templates/$(name).service.j2 ] && echo true || echo false)) + $(eval export depends=$($*.gz_PACKAGE_DEPENDS)) + $(eval export requires=$($*.gz_SERVICE_REQUIRES)) + $(eval export after=$($*.gz_SERVICE_AFTER)) + $(eval export before=$($*.gz_SERVICE_BEFORE)) + $(eval export dependent_of=$($*.gz_SERVICE_DEPENDENT_OF)) + $(eval export privileged=$($*.gz_CONTAINER_PRIVILEGED)) + $(eval export volumes=$($*.gz_CONTAINER_VOLUMES)) + $(eval export tmpfs=$($*.gz_CONTAINER_TMPFS)) + $(eval export config_cli_plugin=$($*.gz_CLI_CONFIG_PLUGIN)) + $(eval export show_cli_plugin=$($*.gz_CLI_SHOW_PLUGIN)) j2 $($*.gz_PATH)/Dockerfile.j2 > $($*.gz_PATH)/Dockerfile + j2 --customize scripts/j2cli/json_filter.py files/build_templates/manifest.json.j2 > $($*.gz_PATH)/manifest.json # Prepare docker build info PACKAGE_URL_PREFIX=$(PACKAGE_URL_PREFIX) \ SONIC_ENFORCE_VERSIONS=$(SONIC_ENFORCE_VERSIONS) \ @@ -753,13 +770,7 @@ $(addprefix $(TARGET_PATH)/, $(DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .platform --build-arg docker_container_name=$($*.gz_CONTAINER_NAME) \ --build-arg frr_user_uid=$(FRR_USER_UID) \ --build-arg frr_user_gid=$(FRR_USER_GID) \ - --build-arg \ - manifest='$(shell \ - [ -f $($*.gz_PATH)/manifest.json.j2 ] && \ - version=$($*.gz_VERSION) \ - name=$($*.gz_CONTAINER_NAME) \ - package_name=$($*.gz_PACKAGE_NAME) \ - j2 $($*.gz_PATH)/manifest.json.j2)' \ + --build-arg manifest="$$(cat $($*.gz_PATH)/manifest.json)" \ --build-arg image_version=$(SONIC_IMAGE_VERSION) \ --label Tag=$(SONIC_IMAGE_VERSION) \ -t $* $($*.gz_PATH) $(LOG) From 113bf3076950adfaa9e1ffa59bc7f91e66ec4e16 Mon Sep 17 00:00:00 2001 From: Stepan Blyschak Date: Fri, 29 Jan 2021 12:54:14 +0000 Subject: [PATCH 21/44] [dockers] use single manifest template Signed-off-by: Stepan Blyschak --- .gitignore | 5 +++ dockers/docker-database/manifest.json.j2 | 13 ------ dockers/docker-dhcp-relay/manifest.json.j2 | 43 ------------------- dockers/docker-fpm-frr/manifest.json.j2 | 21 --------- dockers/docker-fpm-gobgp/manifest.json.j2 | 21 --------- dockers/docker-fpm-quagga/manifest.json.j2 | 21 --------- dockers/docker-iccpd/manifest.json.j2 | 17 -------- dockers/docker-lldp/manifest.json.j2 | 17 -------- dockers/docker-nat/manifest.json.j2 | 17 -------- dockers/docker-orchagent/manifest.json.j2 | 17 -------- .../docker-platform-monitor/manifest.json.j2 | 16 ------- .../docker-router-advertiser/manifest.json.j2 | 16 ------- dockers/docker-sflow/manifest.json.j2 | 17 -------- dockers/docker-snmp/manifest.json.j2 | 17 -------- .../manifest.json.j2 | 17 -------- dockers/docker-sonic-restapi/manifest.json.j2 | 17 -------- .../docker-sonic-telemetry/manifest.json.j2 | 17 -------- dockers/docker-teamd/manifest.json.j2 | 17 -------- files/build_templates/manifest.json.j2 | 27 ++++++++++++ .../docker-syncd-bfn/manifest.json.j2 | 1 - .../docker-syncd-brcm/manifest.json.j2 | 1 - .../cavium/docker-syncd-cavm/manifest.json.j2 | 1 - .../docker-syncd-centec/manifest.json.j2 | 1 - .../docker-syncd-centec/manifest.json.j2 | 1 - .../docker-syncd-invm/manifest.json.j2 | 1 - .../docker-syncd-mrvl/manifest.json.j2 | 1 - .../docker-syncd-mrvl/manifest.json.j2 | 1 - .../docker-syncd-mrvl/manifest.json.j2 | 1 - .../docker-syncd-mlnx/manifest.json.j2 | 1 - .../docker-syncd-nephos/manifest.json.j2 | 1 - .../vs/docker-gbsyncd-vs/manifest.json.j2 | 1 - platform/vs/docker-syncd-vs/manifest.json.j2 | 1 - scripts/j2cli/json_filter.py | 12 ++++++ slave.mk | 25 ++++++++--- 34 files changed, 62 insertions(+), 341 deletions(-) delete mode 100644 dockers/docker-database/manifest.json.j2 delete mode 100644 dockers/docker-dhcp-relay/manifest.json.j2 delete mode 100644 dockers/docker-fpm-frr/manifest.json.j2 delete mode 100644 dockers/docker-fpm-gobgp/manifest.json.j2 delete mode 100644 dockers/docker-fpm-quagga/manifest.json.j2 delete mode 100644 dockers/docker-iccpd/manifest.json.j2 delete mode 100644 dockers/docker-lldp/manifest.json.j2 delete mode 100644 dockers/docker-nat/manifest.json.j2 delete mode 100644 dockers/docker-orchagent/manifest.json.j2 delete mode 100644 dockers/docker-platform-monitor/manifest.json.j2 delete mode 100644 dockers/docker-router-advertiser/manifest.json.j2 delete mode 100644 dockers/docker-sflow/manifest.json.j2 delete mode 100644 dockers/docker-snmp/manifest.json.j2 delete mode 100644 dockers/docker-sonic-mgmt-framework/manifest.json.j2 delete mode 100644 dockers/docker-sonic-restapi/manifest.json.j2 delete mode 100644 dockers/docker-sonic-telemetry/manifest.json.j2 delete mode 100644 dockers/docker-teamd/manifest.json.j2 create mode 100644 files/build_templates/manifest.json.j2 delete mode 120000 platform/barefoot/docker-syncd-bfn/manifest.json.j2 delete mode 120000 platform/broadcom/docker-syncd-brcm/manifest.json.j2 delete mode 120000 platform/cavium/docker-syncd-cavm/manifest.json.j2 delete mode 120000 platform/centec-arm64/docker-syncd-centec/manifest.json.j2 delete mode 120000 platform/centec/docker-syncd-centec/manifest.json.j2 delete mode 120000 platform/innovium/docker-syncd-invm/manifest.json.j2 delete mode 120000 platform/marvell-arm64/docker-syncd-mrvl/manifest.json.j2 delete mode 120000 platform/marvell-armhf/docker-syncd-mrvl/manifest.json.j2 delete mode 120000 platform/marvell/docker-syncd-mrvl/manifest.json.j2 delete mode 120000 platform/mellanox/docker-syncd-mlnx/manifest.json.j2 delete mode 120000 platform/nephos/docker-syncd-nephos/manifest.json.j2 delete mode 120000 platform/vs/docker-gbsyncd-vs/manifest.json.j2 delete mode 120000 platform/vs/docker-syncd-vs/manifest.json.j2 create mode 100644 scripts/j2cli/json_filter.py diff --git a/.gitignore b/.gitignore index 7e2f73f718e9..6f7da6d22f22 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,7 @@ target/ *-dbg *dbg.j2 *.img +*.pyc # Autogenerated Dockerfiles sonic-slave*/Dockerfile @@ -27,6 +28,10 @@ sonic-slave*/Dockerfile.user dockers/*/Dockerfile platform/*/docker-*/Dockerfile +# Autogenerated manifest files +dockers/*/manifest.json +platform/*/docker-*/manifest.json + # Installer-related files and directories installer/x86_64/platforms/ diff --git a/dockers/docker-database/manifest.json.j2 b/dockers/docker-database/manifest.json.j2 deleted file mode 100644 index c08f7acfb849..000000000000 --- a/dockers/docker-database/manifest.json.j2 +++ /dev/null @@ -1,13 +0,0 @@ -{ - "version": "1.0.0", - "package": { - "version": "{{ version }}", - "base-os-contraint": "^1.0.0", - "name": "{{ package_name }}" - }, - "service": { - "name": "{{ name }}", - "asic-service": true, - "host-service": true - } -} diff --git a/dockers/docker-dhcp-relay/manifest.json.j2 b/dockers/docker-dhcp-relay/manifest.json.j2 deleted file mode 100644 index f290c220bad2..000000000000 --- a/dockers/docker-dhcp-relay/manifest.json.j2 +++ /dev/null @@ -1,43 +0,0 @@ -{ - "version": "1.0.0", - "package": { - "version": "{{ version }}", - "base-os-contraint": "^1.0.0", - "depends": [ - "database^1.0.0" - ], - "name": "{{ package_name }}" - }, - "service": { - "name": "{{ name }}", - "requires": [ - "updategraph" - ], - "after": [ - "swss", - "syncd", - "teamd" - ], - "before": [ - "ntp-config" - ], - "dependent-of": ["swss"], - "asic-service": false, - "host-service": true - }, - "container": { - "privileged": true, - "volumes": [ - "/etc/sonic:/etc/sonic:ro", - "/usr/share/sonic/scripts:/usr/share/sonic/scripts:ro" - ], - "tmpfs": [ - "/tmp/", - "/var/tmp/" - ] - }, - "cli": { - "config": "/cli/config/plugins/dhcp_relay.py", - "show": "/cli/show/plugins/dhcp_relay.py" - } -} diff --git a/dockers/docker-fpm-frr/manifest.json.j2 b/dockers/docker-fpm-frr/manifest.json.j2 deleted file mode 100644 index dfc63fca1a6d..000000000000 --- a/dockers/docker-fpm-frr/manifest.json.j2 +++ /dev/null @@ -1,21 +0,0 @@ -{ - "version": "1.0.0", - "package": { - "version": "{{ version }}", - "base-os-contraint": "^1.0.0", - "depends": [ - "database^1.0.0", - "swss^1.0.0" - ], - "conflicts": [ - "fpm-gobgp", - "fpm-quagga" - ], - "name": "{{ package_name }}" - }, - "service": { - "name": "{{ name }}", - "asic-service": true, - "host-service": false - } -} diff --git a/dockers/docker-fpm-gobgp/manifest.json.j2 b/dockers/docker-fpm-gobgp/manifest.json.j2 deleted file mode 100644 index 982772f1aafa..000000000000 --- a/dockers/docker-fpm-gobgp/manifest.json.j2 +++ /dev/null @@ -1,21 +0,0 @@ -{ - "version": "1.0.0", - "package": { - "version": "{{ version }}", - "base-os-contraint": "^1.0.0", - "depends": [ - "database^1.0.0", - "swss^1.0.0" - ], - "conflicts": [ - "fpm-frr", - "fpm-quagga" - ], - "name": "{{ package_name }}" - }, - "service": { - "name": "{{ name }}", - "asic-service": true, - "host-service": false - } -} diff --git a/dockers/docker-fpm-quagga/manifest.json.j2 b/dockers/docker-fpm-quagga/manifest.json.j2 deleted file mode 100644 index 1f2daf816ea6..000000000000 --- a/dockers/docker-fpm-quagga/manifest.json.j2 +++ /dev/null @@ -1,21 +0,0 @@ -{ - "version": "1.0.0", - "package": { - "version": "{{ version }}", - "base-os-contraint": "^1.0.0", - "depends": [ - "database^1.0.0", - "swss^1.0.0" - ], - "conflicts": [ - "fpm-gobgp", - "fpm-frr" - ], - "name": "{{ package_name }}" - }, - "service": { - "name": "{{ name }}", - "asic-service": true, - "host-service": false - } -} diff --git a/dockers/docker-iccpd/manifest.json.j2 b/dockers/docker-iccpd/manifest.json.j2 deleted file mode 100644 index bbce95399868..000000000000 --- a/dockers/docker-iccpd/manifest.json.j2 +++ /dev/null @@ -1,17 +0,0 @@ -{ - "version": "1.0.0", - "package": { - "version": "{{ version }}", - "base-os-contraint": "^1.0.0", - "depends": [ - "database^1.0.0", - "swss^1.0.0" - ], - "name": "{{ package_name }}" - }, - "service": { - "name": "{{ name }}", - "asic-service": false, - "host-service": true - } -} diff --git a/dockers/docker-lldp/manifest.json.j2 b/dockers/docker-lldp/manifest.json.j2 deleted file mode 100644 index d1edab0d4d98..000000000000 --- a/dockers/docker-lldp/manifest.json.j2 +++ /dev/null @@ -1,17 +0,0 @@ -{ - "version": "1.0.0", - "package": { - "version": "{{ version }}", - "base-os-contraint": "^1.0.0", - "depends": [ - "database^1.0.0", - "swss^1.0.0" - ], - "name": "{{ package_name }}" - }, - "service": { - "name": "{{ name }}", - "asic-service": true, - "host-service": true - } -} diff --git a/dockers/docker-nat/manifest.json.j2 b/dockers/docker-nat/manifest.json.j2 deleted file mode 100644 index bbce95399868..000000000000 --- a/dockers/docker-nat/manifest.json.j2 +++ /dev/null @@ -1,17 +0,0 @@ -{ - "version": "1.0.0", - "package": { - "version": "{{ version }}", - "base-os-contraint": "^1.0.0", - "depends": [ - "database^1.0.0", - "swss^1.0.0" - ], - "name": "{{ package_name }}" - }, - "service": { - "name": "{{ name }}", - "asic-service": false, - "host-service": true - } -} diff --git a/dockers/docker-orchagent/manifest.json.j2 b/dockers/docker-orchagent/manifest.json.j2 deleted file mode 100644 index ac3d07d87564..000000000000 --- a/dockers/docker-orchagent/manifest.json.j2 +++ /dev/null @@ -1,17 +0,0 @@ -{ - "version": "1.0.0", - "package": { - "version": "{{ version }}", - "base-os-contraint": "^1.0.0", - "depends": [ - "database^1.0.0", - "syncd^1.0.0" - ], - "name": "{{ package_name }}" - }, - "service": { - "name": "{{ name }}", - "asic-service": true, - "host-service": false - } -} diff --git a/dockers/docker-platform-monitor/manifest.json.j2 b/dockers/docker-platform-monitor/manifest.json.j2 deleted file mode 100644 index 11e5a832d39c..000000000000 --- a/dockers/docker-platform-monitor/manifest.json.j2 +++ /dev/null @@ -1,16 +0,0 @@ -{ - "version": "1.0.0", - "package": { - "version": "{{ version }}", - "base-os-contraint": "^1.0.0", - "depends": [ - "database^1.0.0" - ], - "name": "{{ package_name }}" - }, - "service": { - "name": "{{ name }}", - "asic-service": false, - "host-service": true - } -} diff --git a/dockers/docker-router-advertiser/manifest.json.j2 b/dockers/docker-router-advertiser/manifest.json.j2 deleted file mode 100644 index 11e5a832d39c..000000000000 --- a/dockers/docker-router-advertiser/manifest.json.j2 +++ /dev/null @@ -1,16 +0,0 @@ -{ - "version": "1.0.0", - "package": { - "version": "{{ version }}", - "base-os-contraint": "^1.0.0", - "depends": [ - "database^1.0.0" - ], - "name": "{{ package_name }}" - }, - "service": { - "name": "{{ name }}", - "asic-service": false, - "host-service": true - } -} diff --git a/dockers/docker-sflow/manifest.json.j2 b/dockers/docker-sflow/manifest.json.j2 deleted file mode 100644 index bbce95399868..000000000000 --- a/dockers/docker-sflow/manifest.json.j2 +++ /dev/null @@ -1,17 +0,0 @@ -{ - "version": "1.0.0", - "package": { - "version": "{{ version }}", - "base-os-contraint": "^1.0.0", - "depends": [ - "database^1.0.0", - "swss^1.0.0" - ], - "name": "{{ package_name }}" - }, - "service": { - "name": "{{ name }}", - "asic-service": false, - "host-service": true - } -} diff --git a/dockers/docker-snmp/manifest.json.j2 b/dockers/docker-snmp/manifest.json.j2 deleted file mode 100644 index bbce95399868..000000000000 --- a/dockers/docker-snmp/manifest.json.j2 +++ /dev/null @@ -1,17 +0,0 @@ -{ - "version": "1.0.0", - "package": { - "version": "{{ version }}", - "base-os-contraint": "^1.0.0", - "depends": [ - "database^1.0.0", - "swss^1.0.0" - ], - "name": "{{ package_name }}" - }, - "service": { - "name": "{{ name }}", - "asic-service": false, - "host-service": true - } -} diff --git a/dockers/docker-sonic-mgmt-framework/manifest.json.j2 b/dockers/docker-sonic-mgmt-framework/manifest.json.j2 deleted file mode 100644 index bbce95399868..000000000000 --- a/dockers/docker-sonic-mgmt-framework/manifest.json.j2 +++ /dev/null @@ -1,17 +0,0 @@ -{ - "version": "1.0.0", - "package": { - "version": "{{ version }}", - "base-os-contraint": "^1.0.0", - "depends": [ - "database^1.0.0", - "swss^1.0.0" - ], - "name": "{{ package_name }}" - }, - "service": { - "name": "{{ name }}", - "asic-service": false, - "host-service": true - } -} diff --git a/dockers/docker-sonic-restapi/manifest.json.j2 b/dockers/docker-sonic-restapi/manifest.json.j2 deleted file mode 100644 index bbce95399868..000000000000 --- a/dockers/docker-sonic-restapi/manifest.json.j2 +++ /dev/null @@ -1,17 +0,0 @@ -{ - "version": "1.0.0", - "package": { - "version": "{{ version }}", - "base-os-contraint": "^1.0.0", - "depends": [ - "database^1.0.0", - "swss^1.0.0" - ], - "name": "{{ package_name }}" - }, - "service": { - "name": "{{ name }}", - "asic-service": false, - "host-service": true - } -} diff --git a/dockers/docker-sonic-telemetry/manifest.json.j2 b/dockers/docker-sonic-telemetry/manifest.json.j2 deleted file mode 100644 index bbce95399868..000000000000 --- a/dockers/docker-sonic-telemetry/manifest.json.j2 +++ /dev/null @@ -1,17 +0,0 @@ -{ - "version": "1.0.0", - "package": { - "version": "{{ version }}", - "base-os-contraint": "^1.0.0", - "depends": [ - "database^1.0.0", - "swss^1.0.0" - ], - "name": "{{ package_name }}" - }, - "service": { - "name": "{{ name }}", - "asic-service": false, - "host-service": true - } -} diff --git a/dockers/docker-teamd/manifest.json.j2 b/dockers/docker-teamd/manifest.json.j2 deleted file mode 100644 index e21b557a079d..000000000000 --- a/dockers/docker-teamd/manifest.json.j2 +++ /dev/null @@ -1,17 +0,0 @@ -{ - "version": "1.0.0", - "package": { - "version": "{{ version }}", - "base-os-contraint": "^1.0.0", - "depends": [ - "database^1.0.0", - "swss^1.0.0" - ], - "name": "{{ package_name }}" - }, - "service": { - "name": "{{ name }}", - "asic-service": true, - "host-service": false - } -} diff --git a/files/build_templates/manifest.json.j2 b/files/build_templates/manifest.json.j2 new file mode 100644 index 000000000000..51bf5a0b270a --- /dev/null +++ b/files/build_templates/manifest.json.j2 @@ -0,0 +1,27 @@ +{ + "version": "1.0.0", + "package": { + "version": "{{ version }}", + "base-os-contraint": "^{{ base_os_ver.split('.')[0] }}.0.0", + "depends": {{ depends.split()|json if depends is defined else []}}, + "name": "{{ package_name }}" + }, + "service": { + "name": "{{ name }}", + "requires": {{ requires.split()|json if requires is defined else [] }}, + "after": {{ after.split()|json if after is defined else [] }}, + "before": {{ before.split()|json if before is defined else [] }}, + "dependent-of": {{ dependent_of.split()|json if dependent_of is defined else [] }}, + "asic-service": {{ asic_service }}, + "host-service": {{ host_service }} + }, + "container": { + "privileged": {{ privileged if privileged else 'false' }}, + "volumes": {{ volumes.split()|json if volumes is defined else [] }}, + "tmpfs": {{ tmpfs.split()|json if tmpfs is defined else [] }} + }, + "cli": { + "config": "{{ config_cli_plugin|default('') }}", + "show": "{{ show_cli_plugin|default('') }}" + } +} diff --git a/platform/barefoot/docker-syncd-bfn/manifest.json.j2 b/platform/barefoot/docker-syncd-bfn/manifest.json.j2 deleted file mode 120000 index affca28ad9a9..000000000000 --- a/platform/barefoot/docker-syncd-bfn/manifest.json.j2 +++ /dev/null @@ -1 +0,0 @@ -../../template/manifest.json.j2 \ No newline at end of file diff --git a/platform/broadcom/docker-syncd-brcm/manifest.json.j2 b/platform/broadcom/docker-syncd-brcm/manifest.json.j2 deleted file mode 120000 index affca28ad9a9..000000000000 --- a/platform/broadcom/docker-syncd-brcm/manifest.json.j2 +++ /dev/null @@ -1 +0,0 @@ -../../template/manifest.json.j2 \ No newline at end of file diff --git a/platform/cavium/docker-syncd-cavm/manifest.json.j2 b/platform/cavium/docker-syncd-cavm/manifest.json.j2 deleted file mode 120000 index affca28ad9a9..000000000000 --- a/platform/cavium/docker-syncd-cavm/manifest.json.j2 +++ /dev/null @@ -1 +0,0 @@ -../../template/manifest.json.j2 \ No newline at end of file diff --git a/platform/centec-arm64/docker-syncd-centec/manifest.json.j2 b/platform/centec-arm64/docker-syncd-centec/manifest.json.j2 deleted file mode 120000 index affca28ad9a9..000000000000 --- a/platform/centec-arm64/docker-syncd-centec/manifest.json.j2 +++ /dev/null @@ -1 +0,0 @@ -../../template/manifest.json.j2 \ No newline at end of file diff --git a/platform/centec/docker-syncd-centec/manifest.json.j2 b/platform/centec/docker-syncd-centec/manifest.json.j2 deleted file mode 120000 index affca28ad9a9..000000000000 --- a/platform/centec/docker-syncd-centec/manifest.json.j2 +++ /dev/null @@ -1 +0,0 @@ -../../template/manifest.json.j2 \ No newline at end of file diff --git a/platform/innovium/docker-syncd-invm/manifest.json.j2 b/platform/innovium/docker-syncd-invm/manifest.json.j2 deleted file mode 120000 index affca28ad9a9..000000000000 --- a/platform/innovium/docker-syncd-invm/manifest.json.j2 +++ /dev/null @@ -1 +0,0 @@ -../../template/manifest.json.j2 \ No newline at end of file diff --git a/platform/marvell-arm64/docker-syncd-mrvl/manifest.json.j2 b/platform/marvell-arm64/docker-syncd-mrvl/manifest.json.j2 deleted file mode 120000 index affca28ad9a9..000000000000 --- a/platform/marvell-arm64/docker-syncd-mrvl/manifest.json.j2 +++ /dev/null @@ -1 +0,0 @@ -../../template/manifest.json.j2 \ No newline at end of file diff --git a/platform/marvell-armhf/docker-syncd-mrvl/manifest.json.j2 b/platform/marvell-armhf/docker-syncd-mrvl/manifest.json.j2 deleted file mode 120000 index affca28ad9a9..000000000000 --- a/platform/marvell-armhf/docker-syncd-mrvl/manifest.json.j2 +++ /dev/null @@ -1 +0,0 @@ -../../template/manifest.json.j2 \ No newline at end of file diff --git a/platform/marvell/docker-syncd-mrvl/manifest.json.j2 b/platform/marvell/docker-syncd-mrvl/manifest.json.j2 deleted file mode 120000 index affca28ad9a9..000000000000 --- a/platform/marvell/docker-syncd-mrvl/manifest.json.j2 +++ /dev/null @@ -1 +0,0 @@ -../../template/manifest.json.j2 \ No newline at end of file diff --git a/platform/mellanox/docker-syncd-mlnx/manifest.json.j2 b/platform/mellanox/docker-syncd-mlnx/manifest.json.j2 deleted file mode 120000 index affca28ad9a9..000000000000 --- a/platform/mellanox/docker-syncd-mlnx/manifest.json.j2 +++ /dev/null @@ -1 +0,0 @@ -../../template/manifest.json.j2 \ No newline at end of file diff --git a/platform/nephos/docker-syncd-nephos/manifest.json.j2 b/platform/nephos/docker-syncd-nephos/manifest.json.j2 deleted file mode 120000 index affca28ad9a9..000000000000 --- a/platform/nephos/docker-syncd-nephos/manifest.json.j2 +++ /dev/null @@ -1 +0,0 @@ -../../template/manifest.json.j2 \ No newline at end of file diff --git a/platform/vs/docker-gbsyncd-vs/manifest.json.j2 b/platform/vs/docker-gbsyncd-vs/manifest.json.j2 deleted file mode 120000 index affca28ad9a9..000000000000 --- a/platform/vs/docker-gbsyncd-vs/manifest.json.j2 +++ /dev/null @@ -1 +0,0 @@ -../../template/manifest.json.j2 \ No newline at end of file diff --git a/platform/vs/docker-syncd-vs/manifest.json.j2 b/platform/vs/docker-syncd-vs/manifest.json.j2 deleted file mode 120000 index affca28ad9a9..000000000000 --- a/platform/vs/docker-syncd-vs/manifest.json.j2 +++ /dev/null @@ -1 +0,0 @@ -../../template/manifest.json.j2 \ No newline at end of file diff --git a/scripts/j2cli/json_filter.py b/scripts/j2cli/json_filter.py new file mode 100644 index 000000000000..62b35ab22dc3 --- /dev/null +++ b/scripts/j2cli/json_filter.py @@ -0,0 +1,12 @@ +import json + + +def extra_filters(): + """ Declare some custom filters. + + Returns: dict(name = function) + """ + return dict( + json=json.dumps, + ) + diff --git a/slave.mk b/slave.mk index af1efe6987c6..7569328dee03 100644 --- a/slave.mk +++ b/slave.mk @@ -738,7 +738,24 @@ $(addprefix $(TARGET_PATH)/, $(DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .platform $(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_pydebs=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_PYTHON_DEBS)))\n" | awk '!a[$$0]++')) $(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_whls=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_PYTHON_WHEELS)))\n" | awk '!a[$$0]++')) $(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_dbgs=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_DBG_PACKAGES)))\n" | awk '!a[$$0]++')) + $(eval export version=$($*.gz_VERSION)) + $(eval export name=$($*.gz_CONTAINER_NAME)) + $(eval export package_name=$($*.gz_PACKAGE_NAME)) + $(eval export base_os_ver=$(BASE_OS_COMPATIBILITY_VERSION)) + $(eval export asic_service=$(shell [ -f files/build_templates/per_namespace/$(name).service.j2 ] && echo true || echo false)) + $(eval export host_service=$(shell [ -f files/build_templates/$(name).service.j2 ] && echo true || echo false)) + $(eval export depends=$($*.gz_PACKAGE_DEPENDS)) + $(eval export requires=$($*.gz_SERVICE_REQUIRES)) + $(eval export after=$($*.gz_SERVICE_AFTER)) + $(eval export before=$($*.gz_SERVICE_BEFORE)) + $(eval export dependent_of=$($*.gz_SERVICE_DEPENDENT_OF)) + $(eval export privileged=$($*.gz_CONTAINER_PRIVILEGED)) + $(eval export volumes=$($*.gz_CONTAINER_VOLUMES)) + $(eval export tmpfs=$($*.gz_CONTAINER_TMPFS)) + $(eval export config_cli_plugin=$($*.gz_CLI_CONFIG_PLUGIN)) + $(eval export show_cli_plugin=$($*.gz_CLI_SHOW_PLUGIN)) j2 $($*.gz_PATH)/Dockerfile.j2 > $($*.gz_PATH)/Dockerfile + j2 --customize scripts/j2cli/json_filter.py files/build_templates/manifest.json.j2 > $($*.gz_PATH)/manifest.json # Prepare docker build info PACKAGE_URL_PREFIX=$(PACKAGE_URL_PREFIX) \ SONIC_ENFORCE_VERSIONS=$(SONIC_ENFORCE_VERSIONS) \ @@ -754,13 +771,7 @@ $(addprefix $(TARGET_PATH)/, $(DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .platform --build-arg docker_container_name=$($*.gz_CONTAINER_NAME) \ --build-arg frr_user_uid=$(FRR_USER_UID) \ --build-arg frr_user_gid=$(FRR_USER_GID) \ - --build-arg \ - manifest='$(shell \ - [ -f $($*.gz_PATH)/manifest.json.j2 ] && \ - version=$($*.gz_VERSION) \ - name=$($*.gz_CONTAINER_NAME) \ - package_name=$($*.gz_PACKAGE_NAME) \ - j2 $($*.gz_PATH)/manifest.json.j2)' \ + --build-arg manifest="$$(cat $($*.gz_PATH)/manifest.json)" \ --build-arg image_version=$(SONIC_IMAGE_VERSION) \ --label Tag=$(SONIC_IMAGE_VERSION) \ -t $* $($*.gz_PATH) $(LOG) From d6abc30e3b3c1fc6b12c96821d3c7a0aafc43cb3 Mon Sep 17 00:00:00 2001 From: Stepan Blyschak Date: Fri, 29 Jan 2021 12:54:56 +0000 Subject: [PATCH 22/44] [docker-dhcp-relay] define manifest parameters in makefile Signed-off-by: Stepan Blyschak --- rules/docker-dhcp-relay.mk | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/rules/docker-dhcp-relay.mk b/rules/docker-dhcp-relay.mk index bdde3afae0d6..807d13bb0b17 100644 --- a/rules/docker-dhcp-relay.mk +++ b/rules/docker-dhcp-relay.mk @@ -17,6 +17,12 @@ $(DOCKER_DHCP_RELAY)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE_BUSTER) $(DOCKER_DHCP_RELAY)_VERSION = 1.0.0 $(DOCKER_DHCP_RELAY)_PACKAGE_NAME = dhcp-relay +$(DOCKER_DHCP_RELAY)_PACKAGE_DEPENDS = database^1.0.0 + +$(DOCKER_DHCP_RELAY)_SERVICE_REQUIRES = updategraph +$(DOCKER_DHCP_RELAY)_SERVICE_AFTER = swss syncd teamd +$(DOCKER_DHCP_RELAY)_SERVICE_BEFORE = ntp-config +$(DOCKER_DHCP_RELAY)_SERVICE_DEPENDENT_OF = swss SONIC_DOCKER_IMAGES += $(DOCKER_DHCP_RELAY) SONIC_DOCKER_DBG_IMAGES += $(DOCKER_DHCP_RELAY_DBG) @@ -34,4 +40,13 @@ SONIC_PACKAGES_LOCAL += $(DOCKER_DHCP_RELAY) endif $(DOCKER_DHCP_RELAY)_CONTAINER_NAME = dhcp_relay +$(DOCKER_DHCP_RELAY)_CONTAINER_PRIVILEGED = true +$(DOCKER_DHCP_RELAY)_CONTAINER_VOLUMES += /etc/sonic:/etc/sonic:ro +$(DOCKER_DHCP_RELAY)_CONTAINER_VOLUMES += /usr/share/sonic/scripts:/usr/share/sonic/scripts:ro +$(DOCKER_DHCP_RELAY)_CONTAINER_TMPFS += /tmp/ +$(DOCKER_DHCP_RELAY)_CONTAINER_TMPFS += /var/tmp/ + +$(DOCKER_DHCP_RELAY)_CLI_CONFIG_PLUGIN = /cli/config/plugins/dhcp_relay.py +$(DOCKER_DHCP_RELAY)_CLI_SHOW_PLUGIN = /cli/show/plugins/dhcp_relay.py + $(DOCKER_DHCP_RELAY)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT) From 422c2451f8758bf37be72e524b589e2606e49bce Mon Sep 17 00:00:00 2001 From: Stepan Blyschak Date: Sat, 30 Jan 2021 20:19:17 +0200 Subject: [PATCH 23/44] tag SONiC images the old way Signed-off-by: Stepan Blyschak --- files/build_templates/sonic_debian_extension.j2 | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 5b8ac0a54db6..8d583ef692f1 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -580,14 +580,13 @@ sudo mount --bind target $FILESYSTEM_ROOT/target sudo chroot $FILESYSTEM_ROOT docker $SONIC_NATIVE_DOCKERD_FOR_DOCKERFS info {% for image in installer_images.strip().split(' ') -%} {% set imagefilepath = image.split(':')|first -%} -{% set imageversion = image.split(':')|last -%} {% set imagefilename = imagefilepath.split('/')|last -%} {% set imagename = imagefilename.split('.')|first -%} sudo LANG=C chroot $FILESYSTEM_ROOT docker $SONIC_NATIVE_DOCKERD_FOR_DOCKERFS load -i {{imagefilepath}} -sudo LANG=C chroot $FILESYSTEM_ROOT docker $SONIC_NATIVE_DOCKERD_FOR_DOCKERFS tag {{imagename}}:latest {{imagename}}:{{imageversion}} +sudo LANG=C chroot $FILESYSTEM_ROOT docker $SONIC_NATIVE_DOCKERD_FOR_DOCKERFS tag {{imagename}}:latest {{imagename}}:"${SONIC_IMAGE_VERSION}" {% if imagename.endswith('-dbg') %} {% set imagebasename = imagename.replace('-dbg', '') -%} -sudo LANG=C chroot $FILESYSTEM_ROOT docker $SONIC_NATIVE_DOCKERD_FOR_DOCKERFS tag {{imagename}}:latest {{imagebasename}}:{{imageversion}} +sudo LANG=C chroot $FILESYSTEM_ROOT docker $SONIC_NATIVE_DOCKERD_FOR_DOCKERFS tag {{imagename}}:latest {{imagebasename}}:"${SONIC_IMAGE_VERSION}" sudo LANG=C chroot $FILESYSTEM_ROOT docker $SONIC_NATIVE_DOCKERD_FOR_DOCKERFS tag {{imagename}}:latest {{imagebasename}}:latest {% endif %} {% endfor %} From 888a0eaa230ef63ea3a21550652570319e50cabd Mon Sep 17 00:00:00 2001 From: Stepan Blyschak Date: Sat, 30 Jan 2021 21:45:36 +0200 Subject: [PATCH 24/44] check if docker has correct manifest after loading it Signed-off-by: Stepan Blyschak --- files/build_templates/sonic_debian_extension.j2 | 7 +++++++ sonic-slave-buster/Dockerfile.j2 | 1 + sonic-slave-jessie/Dockerfile.j2 | 1 + sonic-slave-stretch/Dockerfile.j2 | 1 + 4 files changed, 10 insertions(+) diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index aaf7736451c6..bd578bea27d6 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -586,6 +586,13 @@ sudo chroot $FILESYSTEM_ROOT docker $SONIC_NATIVE_DOCKERD_FOR_DOCKERFS info {% set imagename = imagefilename.split('.')|first -%} sudo LANG=C chroot $FILESYSTEM_ROOT docker $SONIC_NATIVE_DOCKERD_FOR_DOCKERFS load -i {{imagefilepath}} sudo LANG=C chroot $FILESYSTEM_ROOT docker $SONIC_NATIVE_DOCKERD_FOR_DOCKERFS tag {{imagename}}:latest {{imagename}}:"${SONIC_IMAGE_VERSION}" +# Check if manifest exists for {{imagename}} and it is a valid JSON +sudo LANG=C chroot $FILESYSTEM_ROOT docker $SONIC_NATIVE_DOCKERD_FOR_DOCKERFS inspect {{imagename}}:latest \ + | jq '.[0].Config.Labels["com.azure.sonic.manifest"]' -r \ + | jq -e || { + >&2 echo "docker image {{imagename}} has no manifest or manifest is not a valid JSON" + exit 1 +} {% if imagename.endswith('-dbg') %} {% set imagebasename = imagename.replace('-dbg', '') -%} sudo LANG=C chroot $FILESYSTEM_ROOT docker $SONIC_NATIVE_DOCKERD_FOR_DOCKERFS tag {{imagename}}:latest {{imagebasename}}:"${SONIC_IMAGE_VERSION}" diff --git a/sonic-slave-buster/Dockerfile.j2 b/sonic-slave-buster/Dockerfile.j2 index 61ece64a1139..cdb5b5348bcc 100644 --- a/sonic-slave-buster/Dockerfile.j2 +++ b/sonic-slave-buster/Dockerfile.j2 @@ -78,6 +78,7 @@ RUN apt-get update && apt-get install -y \ dh-systemd \ libzmq5 \ libzmq3-dev \ + jq \ # For quagga build libreadline-dev \ texlive-latex-base \ diff --git a/sonic-slave-jessie/Dockerfile.j2 b/sonic-slave-jessie/Dockerfile.j2 index f103dfb789b9..17e6827d1985 100644 --- a/sonic-slave-jessie/Dockerfile.j2 +++ b/sonic-slave-jessie/Dockerfile.j2 @@ -63,6 +63,7 @@ RUN apt-get update && apt-get install -y \ perl-modules \ libswitch-perl \ dh-systemd \ + jq \ # For quagga build libreadline-dev \ texlive-latex-base \ diff --git a/sonic-slave-stretch/Dockerfile.j2 b/sonic-slave-stretch/Dockerfile.j2 index 103a9cd77831..ecdbcd4197ee 100644 --- a/sonic-slave-stretch/Dockerfile.j2 +++ b/sonic-slave-stretch/Dockerfile.j2 @@ -76,6 +76,7 @@ RUN apt-get update && apt-get install -y \ dh-systemd \ libzmq5 \ libzmq3-dev \ + jq \ # For quagga build libreadline-dev \ texlive-latex-base \ From 8ad8a056f78ba1d14e96de45a0e4ba6f933f3c97 Mon Sep 17 00:00:00 2001 From: Stepan Blyshchak Date: Wed, 10 Feb 2021 03:37:15 +0200 Subject: [PATCH 25/44] address review comment Signed-off-by: Stepan Blyshchak --- dockers/docker-dhcp-relay/cli/show/plugins/dhcp_relay.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockers/docker-dhcp-relay/cli/show/plugins/dhcp_relay.py b/dockers/docker-dhcp-relay/cli/show/plugins/dhcp_relay.py index a1240dc57a1d..ba7e086297d9 100644 --- a/dockers/docker-dhcp-relay/cli/show/plugins/dhcp_relay.py +++ b/dockers/docker-dhcp-relay/cli/show/plugins/dhcp_relay.py @@ -14,7 +14,7 @@ def get_dhcp_helper_address(ctx, vlan): return '\n'.join(natsorted(dhcp_helpers)) -vlan.VlanBrief.COLUMNS.append(('DHCP Helper Address', get_dhcp_helper_address)) +vlan.VlanBrief.register_column('DHCP Helper Address', get_dhcp_helper_address) def register(cli): From 53631d73ac0163b824ca07007028f4ea1772a870 Mon Sep 17 00:00:00 2001 From: Stepan Blyshchak Date: Mon, 15 Feb 2021 17:03:36 +0200 Subject: [PATCH 26/44] fix checking manifest Signed-off-by: Stepan Blyshchak --- files/build_templates/sonic_debian_extension.j2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index bd578bea27d6..b27d7c6343e5 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -588,8 +588,8 @@ sudo LANG=C chroot $FILESYSTEM_ROOT docker $SONIC_NATIVE_DOCKERD_FOR_DOCKERFS lo sudo LANG=C chroot $FILESYSTEM_ROOT docker $SONIC_NATIVE_DOCKERD_FOR_DOCKERFS tag {{imagename}}:latest {{imagename}}:"${SONIC_IMAGE_VERSION}" # Check if manifest exists for {{imagename}} and it is a valid JSON sudo LANG=C chroot $FILESYSTEM_ROOT docker $SONIC_NATIVE_DOCKERD_FOR_DOCKERFS inspect {{imagename}}:latest \ - | jq '.[0].Config.Labels["com.azure.sonic.manifest"]' -r \ - | jq -e || { + | jq '.[0].Config.Labels["com.azure.sonic.manifest"]' -r > /tmp/manifest.json +jq -e . /tmp/manifest.json || { >&2 echo "docker image {{imagename}} has no manifest or manifest is not a valid JSON" exit 1 } From 3de0cb358a8146267430e28d4a201d2aff69de69 Mon Sep 17 00:00:00 2001 From: Stepan Blyschak Date: Thu, 25 Mar 2021 17:02:13 +0200 Subject: [PATCH 27/44] remove obsolete file Signed-off-by: Stepan Blyschak --- platform/template/manifest.json.j2 | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 platform/template/manifest.json.j2 diff --git a/platform/template/manifest.json.j2 b/platform/template/manifest.json.j2 deleted file mode 100644 index 7c2528a3bb43..000000000000 --- a/platform/template/manifest.json.j2 +++ /dev/null @@ -1,16 +0,0 @@ -{ - "version": "1.0.0", - "package": { - "version": "{{ version }}", - "base-os-contraint": "^1.0.0", - "depends": [ - "database^1.0.0" - ], - "name": "{{ package_name }}" - }, - "service": { - "name": "{{ name }}", - "asic-service": true, - "host-service": false - } -} From b2f8fc9d4afe2ab211a7f6e061a8b73ab6dc278d Mon Sep 17 00:00:00 2001 From: Stepan Blyschak Date: Mon, 29 Mar 2021 16:48:51 +0300 Subject: [PATCH 28/44] remove obsolete field from manifest. will be replaced by base-os components approacgh Signed-off-by: Stepan Blyschak --- files/build_templates/manifest.json.j2 | 1 - 1 file changed, 1 deletion(-) diff --git a/files/build_templates/manifest.json.j2 b/files/build_templates/manifest.json.j2 index 51bf5a0b270a..5b09e1d987bc 100644 --- a/files/build_templates/manifest.json.j2 +++ b/files/build_templates/manifest.json.j2 @@ -2,7 +2,6 @@ "version": "1.0.0", "package": { "version": "{{ version }}", - "base-os-contraint": "^{{ base_os_ver.split('.')[0] }}.0.0", "depends": {{ depends.split()|json if depends is defined else []}}, "name": "{{ package_name }}" }, From 84bf4dd6280f241431be1c83d83a20a310370516 Mon Sep 17 00:00:00 2001 From: Stepan Blyschak Date: Fri, 9 Apr 2021 15:18:40 +0300 Subject: [PATCH 29/44] fix review comments Signed-off-by: Stepan Blyschak --- dockers/docker-database/Dockerfile.j2 | 2 -- dockers/docker-dhcp-relay/Dockerfile.j2 | 2 -- dockers/docker-fpm-frr/Dockerfile.j2 | 2 -- dockers/docker-fpm-gobgp/Dockerfile.j2 | 2 -- dockers/docker-fpm-quagga/Dockerfile.j2 | 2 -- dockers/docker-iccpd/Dockerfile.j2 | 2 -- dockers/docker-lldp/Dockerfile.j2 | 2 -- dockers/docker-macsec/Dockerfile.j2 | 2 -- dockers/docker-nat/Dockerfile.j2 | 2 -- dockers/docker-orchagent/Dockerfile.j2 | 2 -- dockers/docker-platform-monitor/Dockerfile.j2 | 2 -- dockers/docker-router-advertiser/Dockerfile.j2 | 2 -- dockers/docker-sflow/Dockerfile.j2 | 2 -- dockers/docker-snmp/Dockerfile.j2 | 2 -- dockers/docker-sonic-mgmt-framework/Dockerfile.j2 | 2 -- dockers/docker-sonic-restapi/Dockerfile.j2 | 2 -- dockers/docker-sonic-telemetry/Dockerfile.j2 | 2 -- dockers/docker-teamd/Dockerfile.j2 | 2 -- platform/barefoot/docker-syncd-bfn/Dockerfile.j2 | 2 -- platform/broadcom/docker-syncd-brcm/Dockerfile.j2 | 2 -- platform/cavium/docker-syncd-cavm/Dockerfile.j2 | 2 -- platform/centec-arm64/docker-syncd-centec/Dockerfile.j2 | 2 -- platform/centec/docker-syncd-centec/Dockerfile.j2 | 2 -- platform/innovium/docker-syncd-invm/Dockerfile.j2 | 2 -- platform/marvell-arm64/docker-syncd-mrvl/Dockerfile.j2 | 2 -- platform/marvell-armhf/docker-syncd-mrvl/Dockerfile.j2 | 2 -- platform/marvell/docker-syncd-mrvl/Dockerfile.j2 | 2 -- platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 | 2 -- platform/nephos/docker-syncd-nephos/Dockerfile.j2 | 2 -- platform/vs/docker-gbsyncd-vs/Dockerfile.j2 | 2 -- platform/vs/docker-syncd-vs/Dockerfile.j2 | 2 -- slave.mk | 3 +-- 32 files changed, 1 insertion(+), 64 deletions(-) diff --git a/dockers/docker-database/Dockerfile.j2 b/dockers/docker-database/Dockerfile.j2 index 9a5d9b5fe4c2..9debbe2423d3 100644 --- a/dockers/docker-database/Dockerfile.j2 +++ b/dockers/docker-database/Dockerfile.j2 @@ -62,6 +62,4 @@ COPY ["critical_processes", "/etc/supervisor"] COPY ["files/update_chassisdb_config", "/usr/local/bin/"] COPY ["flush_unused_database", "/usr/local/bin/"] -LABEL com.azure.sonic.manifest="$manifest" - ENTRYPOINT ["/usr/local/bin/docker-database-init.sh"] diff --git a/dockers/docker-dhcp-relay/Dockerfile.j2 b/dockers/docker-dhcp-relay/Dockerfile.j2 index d7de3016b6f0..76a1f1c2a055 100644 --- a/dockers/docker-dhcp-relay/Dockerfile.j2 +++ b/dockers/docker-dhcp-relay/Dockerfile.j2 @@ -35,6 +35,4 @@ COPY ["docker-dhcp-relay.supervisord.conf.j2", "port-name-alias-map.txt.j2", "wa COPY ["files/supervisor-proc-exit-listener", "/usr/bin"] COPY ["critical_processes", "/etc/supervisor"] -LABEL com.azure.sonic.manifest="$manifest" - ENTRYPOINT ["/usr/bin/docker_init.sh"] diff --git a/dockers/docker-fpm-frr/Dockerfile.j2 b/dockers/docker-fpm-frr/Dockerfile.j2 index 91a826b90c3a..bde0812975d2 100644 --- a/dockers/docker-fpm-frr/Dockerfile.j2 +++ b/dockers/docker-fpm-frr/Dockerfile.j2 @@ -63,6 +63,4 @@ RUN chmod a+x /usr/bin/TSA && \ chmod a+x /usr/bin/TSC && \ chmod a+x /usr/bin/zsocket.sh -LABEL com.azure.sonic.manifest="$manifest" - ENTRYPOINT ["/usr/bin/docker_init.sh"] diff --git a/dockers/docker-fpm-gobgp/Dockerfile.j2 b/dockers/docker-fpm-gobgp/Dockerfile.j2 index 9c8569450fa2..f61f7fb244d5 100644 --- a/dockers/docker-fpm-gobgp/Dockerfile.j2 +++ b/dockers/docker-fpm-gobgp/Dockerfile.j2 @@ -30,6 +30,4 @@ COPY ["daemons", "/etc/quagga/"] COPY ["files/supervisor-proc-exit-listener", "/usr/bin"] COPY ["critical_processes", "/etc/supervisor"] -LABEL com.azure.sonic.manifest="$manifest" - ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/dockers/docker-fpm-quagga/Dockerfile.j2 b/dockers/docker-fpm-quagga/Dockerfile.j2 index 5b9aabcb411d..4a34226b022f 100644 --- a/dockers/docker-fpm-quagga/Dockerfile.j2 +++ b/dockers/docker-fpm-quagga/Dockerfile.j2 @@ -38,6 +38,4 @@ COPY ["*.j2", "/usr/share/sonic/templates/"] COPY ["files/supervisor-proc-exit-listener", "/usr/bin"] COPY ["critical_processes", "/etc/supervisor"] -LABEL com.azure.sonic.manifest="$manifest" - ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/dockers/docker-iccpd/Dockerfile.j2 b/dockers/docker-iccpd/Dockerfile.j2 index 0a42ee0d0a0d..3102bf22c84c 100644 --- a/dockers/docker-iccpd/Dockerfile.j2 +++ b/dockers/docker-iccpd/Dockerfile.j2 @@ -33,6 +33,4 @@ RUN apt-get clean -y && \ apt-get autoremove -y && \ rm -rf /debs -LABEL com.azure.sonic.manifest="$manifest" - ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/dockers/docker-lldp/Dockerfile.j2 b/dockers/docker-lldp/Dockerfile.j2 index b0a672aaccec..076018afe25a 100644 --- a/dockers/docker-lldp/Dockerfile.j2 +++ b/dockers/docker-lldp/Dockerfile.j2 @@ -51,6 +51,4 @@ COPY ["lldpmgrd", "/usr/bin/"] COPY ["files/supervisor-proc-exit-listener", "/usr/bin"] COPY ["critical_processes", "/etc/supervisor"] -LABEL com.azure.sonic.manifest="$manifest" - ENTRYPOINT ["/usr/bin/docker-lldp-init.sh"] diff --git a/dockers/docker-macsec/Dockerfile.j2 b/dockers/docker-macsec/Dockerfile.j2 index 0deb6777e645..9328b2549d19 100644 --- a/dockers/docker-macsec/Dockerfile.j2 +++ b/dockers/docker-macsec/Dockerfile.j2 @@ -29,6 +29,4 @@ COPY ["files/supervisor-proc-exit-listener", "/usr/bin"] COPY ["critical_processes", "/etc/supervisor"] COPY ["etc/wpa_supplicant.conf", "/etc/wpa_supplicant.conf"] -LABEL com.azure.sonic.manifest="$manifest" - ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/dockers/docker-nat/Dockerfile.j2 b/dockers/docker-nat/Dockerfile.j2 index 6281ffec2749..7ed5d316419b 100644 --- a/dockers/docker-nat/Dockerfile.j2 +++ b/dockers/docker-nat/Dockerfile.j2 @@ -37,6 +37,4 @@ COPY ["critical_processes", "/etc/supervisor"] RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs -LABEL com.azure.sonic.manifest="$manifest" - ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/dockers/docker-orchagent/Dockerfile.j2 b/dockers/docker-orchagent/Dockerfile.j2 index 06dce5cd4342..a6553f8d202c 100755 --- a/dockers/docker-orchagent/Dockerfile.j2 +++ b/dockers/docker-orchagent/Dockerfile.j2 @@ -77,6 +77,4 @@ COPY ["critical_processes", "/etc/supervisor/"] # Copy all Jinja2 template files into the templates folder COPY ["*.j2", "/usr/share/sonic/templates/"] -LABEL com.azure.sonic.manifest="$manifest" - ENTRYPOINT ["/usr/bin/docker-init.sh"] diff --git a/dockers/docker-platform-monitor/Dockerfile.j2 b/dockers/docker-platform-monitor/Dockerfile.j2 index c5fa00d484ac..63086966eed3 100755 --- a/dockers/docker-platform-monitor/Dockerfile.j2 +++ b/dockers/docker-platform-monitor/Dockerfile.j2 @@ -92,6 +92,4 @@ COPY ["ssd_tools/*", "/usr/bin/"] COPY ["files/supervisor-proc-exit-listener", "/usr/bin"] COPY ["critical_processes", "/etc/supervisor"] -LABEL com.azure.sonic.manifest="$manifest" - ENTRYPOINT ["/usr/bin/docker_init.sh"] diff --git a/dockers/docker-router-advertiser/Dockerfile.j2 b/dockers/docker-router-advertiser/Dockerfile.j2 index 1e471898c358..81cd447c7007 100644 --- a/dockers/docker-router-advertiser/Dockerfile.j2 +++ b/dockers/docker-router-advertiser/Dockerfile.j2 @@ -39,6 +39,4 @@ COPY ["radvd.conf.j2", "wait_for_link.sh.j2", "docker-router-advertiser.supervis COPY ["files/supervisor-proc-exit-listener", "/usr/bin"] COPY ["critical_processes", "/etc/supervisor"] -LABEL com.azure.sonic.manifest="$manifest" - ENTRYPOINT ["/usr/bin/docker-init.sh"] diff --git a/dockers/docker-sflow/Dockerfile.j2 b/dockers/docker-sflow/Dockerfile.j2 index 5181e7db93bf..474785234c0c 100644 --- a/dockers/docker-sflow/Dockerfile.j2 +++ b/dockers/docker-sflow/Dockerfile.j2 @@ -34,6 +34,4 @@ COPY ["files/supervisor-proc-exit-listener", "/usr/bin"] COPY ["critical_processes", "/etc/supervisor"] COPY ["port_index_mapper.py", "/usr/bin"] -LABEL com.azure.sonic.manifest="$manifest" - ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/dockers/docker-snmp/Dockerfile.j2 b/dockers/docker-snmp/Dockerfile.j2 index 07ccaa9c5834..392e72ab07bc 100644 --- a/dockers/docker-snmp/Dockerfile.j2 +++ b/dockers/docker-snmp/Dockerfile.j2 @@ -79,6 +79,4 @@ COPY ["critical_processes", "/etc/supervisor"] # Although exposing ports is not needed for host net mode, keep it for possible bridge mode EXPOSE 161/udp 162/udp -LABEL com.azure.sonic.manifest="$manifest" - ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/dockers/docker-sonic-mgmt-framework/Dockerfile.j2 b/dockers/docker-sonic-mgmt-framework/Dockerfile.j2 index cb6953d0e595..f937e00f9700 100644 --- a/dockers/docker-sonic-mgmt-framework/Dockerfile.j2 +++ b/dockers/docker-sonic-mgmt-framework/Dockerfile.j2 @@ -55,6 +55,4 @@ RUN apt-get remove -y g++ python3-dev RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs -LABEL com.azure.sonic.manifest="$manifest" - ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/dockers/docker-sonic-restapi/Dockerfile.j2 b/dockers/docker-sonic-restapi/Dockerfile.j2 index b3b5542dff3b..999b33a3bd61 100644 --- a/dockers/docker-sonic-restapi/Dockerfile.j2 +++ b/dockers/docker-sonic-restapi/Dockerfile.j2 @@ -27,6 +27,4 @@ COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] COPY ["files/supervisor-proc-exit-listener", "/usr/bin"] COPY ["critical_processes", "/etc/supervisor"] -LABEL com.azure.sonic.manifest="$manifest" - ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/dockers/docker-sonic-telemetry/Dockerfile.j2 b/dockers/docker-sonic-telemetry/Dockerfile.j2 index 8a06a3676141..87f47d0c5383 100644 --- a/dockers/docker-sonic-telemetry/Dockerfile.j2 +++ b/dockers/docker-sonic-telemetry/Dockerfile.j2 @@ -34,6 +34,4 @@ COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] COPY ["files/supervisor-proc-exit-listener", "/usr/bin"] COPY ["critical_processes", "/etc/supervisor"] -LABEL com.azure.sonic.manifest="$manifest" - ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/dockers/docker-teamd/Dockerfile.j2 b/dockers/docker-teamd/Dockerfile.j2 index 29f8cb3955f0..08963ec45dce 100644 --- a/dockers/docker-teamd/Dockerfile.j2 +++ b/dockers/docker-teamd/Dockerfile.j2 @@ -29,6 +29,4 @@ COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] COPY ["files/supervisor-proc-exit-listener", "/usr/bin"] COPY ["critical_processes", "/etc/supervisor"] -LABEL com.azure.sonic.manifest="$manifest" - ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/platform/barefoot/docker-syncd-bfn/Dockerfile.j2 b/platform/barefoot/docker-syncd-bfn/Dockerfile.j2 index 326c65bace78..baeddf1e6a3a 100755 --- a/platform/barefoot/docker-syncd-bfn/Dockerfile.j2 +++ b/platform/barefoot/docker-syncd-bfn/Dockerfile.j2 @@ -39,6 +39,4 @@ COPY ["critical_processes", "/etc/supervisor/"] RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs -LABEL com.azure.sonic.manifest="$manifest" - ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 b/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 index eb3b96974f47..41de1ca063b1 100755 --- a/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 +++ b/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 @@ -37,6 +37,4 @@ COPY ["critical_processes", "/etc/supervisor/"] RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs -LABEL com.azure.sonic.manifest="$manifest" - ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/platform/cavium/docker-syncd-cavm/Dockerfile.j2 b/platform/cavium/docker-syncd-cavm/Dockerfile.j2 index 3a93f9acb23f..fb19dc9636d4 100755 --- a/platform/cavium/docker-syncd-cavm/Dockerfile.j2 +++ b/platform/cavium/docker-syncd-cavm/Dockerfile.j2 @@ -34,6 +34,4 @@ COPY ["profile.ini", "/etc/ssw/AS7512/"] RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs -LABEL com.azure.sonic.manifest="$manifest" - ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/platform/centec-arm64/docker-syncd-centec/Dockerfile.j2 b/platform/centec-arm64/docker-syncd-centec/Dockerfile.j2 index c00275f75f1c..8a029150413d 100755 --- a/platform/centec-arm64/docker-syncd-centec/Dockerfile.j2 +++ b/platform/centec-arm64/docker-syncd-centec/Dockerfile.j2 @@ -36,6 +36,4 @@ COPY ["critical_processes", "/etc/supervisor/"] RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs -LABEL com.azure.sonic.manifest="$manifest" - ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/platform/centec/docker-syncd-centec/Dockerfile.j2 b/platform/centec/docker-syncd-centec/Dockerfile.j2 index d170761c559b..6ce34616de00 100755 --- a/platform/centec/docker-syncd-centec/Dockerfile.j2 +++ b/platform/centec/docker-syncd-centec/Dockerfile.j2 @@ -32,6 +32,4 @@ COPY ["critical_processes", "/etc/supervisor/"] RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs -LABEL com.azure.sonic.manifest="$manifest" - ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/platform/innovium/docker-syncd-invm/Dockerfile.j2 b/platform/innovium/docker-syncd-invm/Dockerfile.j2 index 3f1a82f28204..e11faf04a2db 100755 --- a/platform/innovium/docker-syncd-invm/Dockerfile.j2 +++ b/platform/innovium/docker-syncd-invm/Dockerfile.j2 @@ -32,6 +32,4 @@ COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs -LABEL com.azure.sonic.manifest="$manifest" - ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/platform/marvell-arm64/docker-syncd-mrvl/Dockerfile.j2 b/platform/marvell-arm64/docker-syncd-mrvl/Dockerfile.j2 index a7b68a729a2a..4b5aa878a7e6 100755 --- a/platform/marvell-arm64/docker-syncd-mrvl/Dockerfile.j2 +++ b/platform/marvell-arm64/docker-syncd-mrvl/Dockerfile.j2 @@ -36,6 +36,4 @@ COPY ["critical_processes", "/etc/supervisor/"] RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs -LABEL com.azure.sonic.manifest="$manifest" - ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/platform/marvell-armhf/docker-syncd-mrvl/Dockerfile.j2 b/platform/marvell-armhf/docker-syncd-mrvl/Dockerfile.j2 index a7b68a729a2a..4b5aa878a7e6 100755 --- a/platform/marvell-armhf/docker-syncd-mrvl/Dockerfile.j2 +++ b/platform/marvell-armhf/docker-syncd-mrvl/Dockerfile.j2 @@ -36,6 +36,4 @@ COPY ["critical_processes", "/etc/supervisor/"] RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs -LABEL com.azure.sonic.manifest="$manifest" - ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/platform/marvell/docker-syncd-mrvl/Dockerfile.j2 b/platform/marvell/docker-syncd-mrvl/Dockerfile.j2 index f75d47070ce6..45c2fd281525 100755 --- a/platform/marvell/docker-syncd-mrvl/Dockerfile.j2 +++ b/platform/marvell/docker-syncd-mrvl/Dockerfile.j2 @@ -32,6 +32,4 @@ COPY ["critical_processes", "/etc/supervisor/"] RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs -LABEL com.azure.sonic.manifest="$manifest" - ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 b/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 index d6d253c07070..f4b81a76b45f 100755 --- a/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 +++ b/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 @@ -47,6 +47,4 @@ COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] COPY ["files/supervisor-proc-exit-listener", "/usr/bin"] COPY ["critical_processes", "/etc/supervisor/"] -LABEL com.azure.sonic.manifest="$manifest" - ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/platform/nephos/docker-syncd-nephos/Dockerfile.j2 b/platform/nephos/docker-syncd-nephos/Dockerfile.j2 index 723f16dfe1b1..104e6f29a410 100755 --- a/platform/nephos/docker-syncd-nephos/Dockerfile.j2 +++ b/platform/nephos/docker-syncd-nephos/Dockerfile.j2 @@ -45,6 +45,4 @@ COPY ["critical_processes", "/etc/supervisor/"] RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs -LABEL com.azure.sonic.manifest="$manifest" - ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/platform/vs/docker-gbsyncd-vs/Dockerfile.j2 b/platform/vs/docker-gbsyncd-vs/Dockerfile.j2 index 23c1066de97b..f2c7e22641bf 100644 --- a/platform/vs/docker-gbsyncd-vs/Dockerfile.j2 +++ b/platform/vs/docker-gbsyncd-vs/Dockerfile.j2 @@ -33,6 +33,4 @@ COPY ["critical_processes", "/etc/supervisor/"] RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs -LABEL com.azure.sonic.manifest="$manifest" - ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/platform/vs/docker-syncd-vs/Dockerfile.j2 b/platform/vs/docker-syncd-vs/Dockerfile.j2 index b1b330e66e77..093efd0bc05a 100644 --- a/platform/vs/docker-syncd-vs/Dockerfile.j2 +++ b/platform/vs/docker-syncd-vs/Dockerfile.j2 @@ -33,6 +33,4 @@ COPY ["critical_processes", "/etc/supervisor/"] RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs -LABEL com.azure.sonic.manifest="$manifest" - ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/slave.mk b/slave.mk index 9617a8c314fd..9388b1de5a15 100644 --- a/slave.mk +++ b/slave.mk @@ -744,7 +744,6 @@ $(addprefix $(TARGET_PATH)/, $(DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .platform $(eval export version=$($*.gz_VERSION)) $(eval export name=$($*.gz_CONTAINER_NAME)) $(eval export package_name=$($*.gz_PACKAGE_NAME)) - $(eval export base_os_ver=$(BASE_OS_COMPATIBILITY_VERSION)) $(eval export asic_service=$(shell [ -f files/build_templates/per_namespace/$(name).service.j2 ] && echo true || echo false)) $(eval export host_service=$(shell [ -f files/build_templates/$(name).service.j2 ] && echo true || echo false)) $(eval export depends=$($*.gz_PACKAGE_DEPENDS)) @@ -774,8 +773,8 @@ $(addprefix $(TARGET_PATH)/, $(DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .platform --build-arg docker_container_name=$($*.gz_CONTAINER_NAME) \ --build-arg frr_user_uid=$(FRR_USER_UID) \ --build-arg frr_user_gid=$(FRR_USER_GID) \ - --build-arg manifest="$$(cat $($*.gz_PATH)/manifest.json)" \ --build-arg image_version=$(SONIC_IMAGE_VERSION) \ + --label com.azure.sonic.manifest="$$(cat $($*.gz_PATH)/manifest.json)" \ --label Tag=$(SONIC_IMAGE_VERSION) \ -t $* $($*.gz_PATH) $(LOG) scripts/collect_docker_version_files.sh $* $(TARGET_PATH) From b427b71db2c17fa8fbb2c4ff7c02d5a96ed7f157 Mon Sep 17 00:00:00 2001 From: Stepan Blyschak Date: Mon, 12 Apr 2021 20:49:56 +0300 Subject: [PATCH 30/44] fix review comments Signed-off-by: Stepan Blyschak --- .gitignore | 4 +-- platform/barefoot/docker-syncd-bfn-rpc.mk | 2 +- platform/broadcom/docker-syncd-brcm-rpc.mk | 2 +- platform/cavium/docker-syncd-cavm-rpc.mk | 2 +- .../centec-arm64/docker-syncd-centec-rpc.mk | 2 +- platform/centec/docker-syncd-centec-rpc.mk | 2 +- platform/innovium/docker-syncd-invm-rpc.mk | 2 +- .../marvell-arm64/docker-syncd-mrvl-rpc.mk | 2 +- .../marvell-armhf/docker-syncd-mrvl-rpc.mk | 2 +- platform/marvell/docker-syncd-mrvl-rpc.mk | 2 +- platform/mellanox/docker-syncd-mlnx-rpc.mk | 2 +- platform/nephos/docker-syncd-nephos-rpc.mk | 2 +- rules/functions | 30 +++++++++++++++++++ slave.mk | 20 ++----------- 14 files changed, 46 insertions(+), 30 deletions(-) diff --git a/.gitignore b/.gitignore index c111efee1180..d608aea9fa3b 100644 --- a/.gitignore +++ b/.gitignore @@ -29,8 +29,8 @@ dockers/*/Dockerfile platform/*/docker-*/Dockerfile # Autogenerated manifest files -dockers/*/manifest.json -platform/*/docker-*/manifest.json +dockers/*/*manifest* +platform/*/docker-*/*manifest* # Installer-related files and directories installer/x86_64/platforms/ diff --git a/platform/barefoot/docker-syncd-bfn-rpc.mk b/platform/barefoot/docker-syncd-bfn-rpc.mk index e14ff946384a..451289d727de 100644 --- a/platform/barefoot/docker-syncd-bfn-rpc.mk +++ b/platform/barefoot/docker-syncd-bfn-rpc.mk @@ -17,7 +17,7 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_BFN_RPC) endif $(DOCKER_SYNCD_BFN_RPC)_CONTAINER_NAME = syncd -$(DOCKER_SYNCD_BFN_RPC)_VERSION = 1.0.0 +$(DOCKER_SYNCD_BFN_RPC)_VERSION = 1.0.0-rpc $(DOCKER_SYNCD_BFN_RPC)_PACKAGE_NAME = syncd $(DOCKER_SYNCD_BFN_RPC)_RUN_OPT += --net=host --privileged -t $(DOCKER_SYNCD_BFN_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf diff --git a/platform/broadcom/docker-syncd-brcm-rpc.mk b/platform/broadcom/docker-syncd-brcm-rpc.mk index 229a3ca08e25..7ee58dda4514 100644 --- a/platform/broadcom/docker-syncd-brcm-rpc.mk +++ b/platform/broadcom/docker-syncd-brcm-rpc.mk @@ -17,7 +17,7 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_BRCM_RPC) endif $(DOCKER_SYNCD_BRCM_RPC)_CONTAINER_NAME = syncd -$(DOCKER_SYNCD_BRCM_RPC)_VERSION = 1.0.0 +$(DOCKER_SYNCD_BRCM_RPC)_VERSION = 1.0.0-rpc $(DOCKER_SYNCD_BRCM_RPC)_PACKAGE_NAME = syncd $(DOCKER_SYNCD_BRCM_RPC)_RUN_OPT += --privileged -t $(DOCKER_SYNCD_BRCM_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf diff --git a/platform/cavium/docker-syncd-cavm-rpc.mk b/platform/cavium/docker-syncd-cavm-rpc.mk index 5112c1b39006..8dfd294b0f43 100644 --- a/platform/cavium/docker-syncd-cavm-rpc.mk +++ b/platform/cavium/docker-syncd-cavm-rpc.mk @@ -17,7 +17,7 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_CAVM_RPC) endif $(DOCKER_SYNCD_CAVM_RPC)_CONTAINER_NAME = syncd -$(DOCKER_SYNCD_CAVM_RPC)_VERSION = 1.0.0 +$(DOCKER_SYNCD_CAVM_RPC)_VERSION = 1.0.0-rpc $(DOCKER_SYNCD_CAVM_RPC)_PACKAGE_NAME = syncd $(DOCKER_SYNCD_CAVM_RPC)_RUN_OPT += --net=host --privileged -t $(DOCKER_SYNCD_CAVM_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf diff --git a/platform/centec-arm64/docker-syncd-centec-rpc.mk b/platform/centec-arm64/docker-syncd-centec-rpc.mk index ae85bbc1d82b..7b6be9cdb3cc 100755 --- a/platform/centec-arm64/docker-syncd-centec-rpc.mk +++ b/platform/centec-arm64/docker-syncd-centec-rpc.mk @@ -17,7 +17,7 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_CENTEC_RPC) endif $(DOCKER_SYNCD_CENTEC_RPC)_CONTAINER_NAME = syncd -$(DOCKER_SYNCD_CENTEC_RPC)_VERSION = 1.0.0 +$(DOCKER_SYNCD_CENTEC_RPC)_VERSION = 1.0.0-rpc $(DOCKER_SYNCD_CENTEC_RPC)_PACKAGE_NAME = syncd $(DOCKER_SYNCD_CENTEC_RPC)_RUN_OPT += --privileged -t $(DOCKER_SYNCD_CENTEC_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf diff --git a/platform/centec/docker-syncd-centec-rpc.mk b/platform/centec/docker-syncd-centec-rpc.mk index 73fdde7262fb..88c101182bb8 100644 --- a/platform/centec/docker-syncd-centec-rpc.mk +++ b/platform/centec/docker-syncd-centec-rpc.mk @@ -17,7 +17,7 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_CENTEC_RPC) endif $(DOCKER_SYNCD_CENTEC_RPC)_CONTAINER_NAME = syncd -$(DOCKER_SYNCD_CENTEC_RPC)_VERSION = 1.0.0 +$(DOCKER_SYNCD_CENTEC_RPC)_VERSION = 1.0.0-rpc $(DOCKER_SYNCD_CENTEC_RPC)_PACKAGE_NAME = syncd $(DOCKER_SYNCD_CENTEC_RPC)_RUN_OPT += --privileged -t $(DOCKER_SYNCD_CENTEC_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf diff --git a/platform/innovium/docker-syncd-invm-rpc.mk b/platform/innovium/docker-syncd-invm-rpc.mk index 65e1febf99a2..e56570d705ba 100755 --- a/platform/innovium/docker-syncd-invm-rpc.mk +++ b/platform/innovium/docker-syncd-invm-rpc.mk @@ -10,7 +10,7 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_INVM_RPC) endif $(DOCKER_SYNCD_INVM_RPC)_CONTAINER_NAME = syncd -$(DOCKER_SYNCD_INVM_RPC)_VERSION = 1.0.0 +$(DOCKER_SYNCD_INVM_RPC)_VERSION = 1.0.0-rpc $(DOCKER_SYNCD_INVM_RPC)_PACKAGE_NAME = syncd $(DOCKER_SYNCD_INVM_RPC)_RUN_OPT += --net=host --privileged -t $(DOCKER_SYNCD_INVM_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf diff --git a/platform/marvell-arm64/docker-syncd-mrvl-rpc.mk b/platform/marvell-arm64/docker-syncd-mrvl-rpc.mk index c63c59006e93..414bc500b453 100644 --- a/platform/marvell-arm64/docker-syncd-mrvl-rpc.mk +++ b/platform/marvell-arm64/docker-syncd-mrvl-rpc.mk @@ -18,7 +18,7 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_MRVL_RPC) endif $(DOCKER_SYNCD_MRVL_RPC)_CONTAINER_NAME = syncd -$(DOCKER_SYNCD_MRVL_RPC)_VERSION = 1.0.0 +$(DOCKER_SYNCD_MRVL_RPC)_VERSION = 1.0.0-rpc $(DOCKER_SYNCD_MRVL_RPC)_PACKAGE_NAME = syncd $(DOCKER_SYNCD_MRVL_RPC)_RUN_OPT += --net=host --privileged -t $(DOCKER_SYNCD_MRVL_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf diff --git a/platform/marvell-armhf/docker-syncd-mrvl-rpc.mk b/platform/marvell-armhf/docker-syncd-mrvl-rpc.mk index c63c59006e93..414bc500b453 100644 --- a/platform/marvell-armhf/docker-syncd-mrvl-rpc.mk +++ b/platform/marvell-armhf/docker-syncd-mrvl-rpc.mk @@ -18,7 +18,7 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_MRVL_RPC) endif $(DOCKER_SYNCD_MRVL_RPC)_CONTAINER_NAME = syncd -$(DOCKER_SYNCD_MRVL_RPC)_VERSION = 1.0.0 +$(DOCKER_SYNCD_MRVL_RPC)_VERSION = 1.0.0-rpc $(DOCKER_SYNCD_MRVL_RPC)_PACKAGE_NAME = syncd $(DOCKER_SYNCD_MRVL_RPC)_RUN_OPT += --net=host --privileged -t $(DOCKER_SYNCD_MRVL_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf diff --git a/platform/marvell/docker-syncd-mrvl-rpc.mk b/platform/marvell/docker-syncd-mrvl-rpc.mk index c63c59006e93..414bc500b453 100644 --- a/platform/marvell/docker-syncd-mrvl-rpc.mk +++ b/platform/marvell/docker-syncd-mrvl-rpc.mk @@ -18,7 +18,7 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_MRVL_RPC) endif $(DOCKER_SYNCD_MRVL_RPC)_CONTAINER_NAME = syncd -$(DOCKER_SYNCD_MRVL_RPC)_VERSION = 1.0.0 +$(DOCKER_SYNCD_MRVL_RPC)_VERSION = 1.0.0-rpc $(DOCKER_SYNCD_MRVL_RPC)_PACKAGE_NAME = syncd $(DOCKER_SYNCD_MRVL_RPC)_RUN_OPT += --net=host --privileged -t $(DOCKER_SYNCD_MRVL_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf diff --git a/platform/mellanox/docker-syncd-mlnx-rpc.mk b/platform/mellanox/docker-syncd-mlnx-rpc.mk index 52085e06f750..fe2ff5916493 100644 --- a/platform/mellanox/docker-syncd-mlnx-rpc.mk +++ b/platform/mellanox/docker-syncd-mlnx-rpc.mk @@ -20,7 +20,7 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_MLNX_RPC) endif $(DOCKER_SYNCD_MLNX_RPC)_CONTAINER_NAME = syncd -$(DOCKER_SYNCD_MLNX_RPC)_VERSION = 1.0.0 +$(DOCKER_SYNCD_MLNX_RPC)_VERSION = 1.0.0-rpc $(DOCKER_SYNCD_MLNX_RPC)_PACKAGE_NAME = syncd $(DOCKER_SYNCD_MLNX_RPC)_RUN_OPT += --privileged -t $(DOCKER_SYNCD_MLNX_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf diff --git a/platform/nephos/docker-syncd-nephos-rpc.mk b/platform/nephos/docker-syncd-nephos-rpc.mk index edc4ffe56076..ea514712c59f 100644 --- a/platform/nephos/docker-syncd-nephos-rpc.mk +++ b/platform/nephos/docker-syncd-nephos-rpc.mk @@ -18,7 +18,7 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_NEPHOS_RPC) endif $(DOCKER_SYNCD_NEPHOS_RPC)_CONTAINER_NAME = syncd -$(DOCKER_SYNCD_NEPHOS_RPC)_VERSION = 1.0.0 +$(DOCKER_SYNCD_NEPHOS_RPC)_VERSION = 1.0.0-rpc $(DOCKER_SYNCD_NEPHOS_RPC)_PACKAGE_NAME = syncd $(DOCKER_SYNCD_NEPHOS_RPC)_RUN_OPT += --net=host --privileged -t $(DOCKER_SYNCD_NEPHOS_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf diff --git a/rules/functions b/rules/functions index c6caebe82858..0a4842ab3a12 100644 --- a/rules/functions +++ b/rules/functions @@ -166,3 +166,33 @@ sudo mount -t overlay overlay -olowerdir=/var/lib/dpkg,upperdir=$$upperdir,workd export SONIC_DPKG_ADMINDIR=$$mergedir trap "sudo umount $$mergedir && rm -rf $$mergedir $$upperdir $$workdir" EXIT endef + + +############################################################### +## Manifest generation routine +### +define generate_manifest + $(eval export version=$($(1).gz_VERSION)$(2)) + $(eval export name=$($(1).gz_CONTAINER_NAME)) + $(eval export package_name=$($(1).gz_PACKAGE_NAME)) + $(eval export asic_service=$(shell [ -f files/build_templates/per_namespace/$(name).service.j2 ] && echo true || echo false)) + $(eval export host_service=$(shell [ -f files/build_templates/$(name).service.j2 ] && echo true || echo false)) + $(eval export depends=$($(1).gz_PACKAGE_DEPENDS)) + $(eval export requires=$($(1).gz_SERVICE_REQUIRES)) + $(eval export after=$($(1).gz_SERVICE_AFTER)) + $(eval export before=$($(1).gz_SERVICE_BEFORE)) + $(eval export dependent_of=$($(1).gz_SERVICE_DEPENDENT_OF)) + $(eval export privileged=$($(1).gz_CONTAINER_PRIVILEGED)) + $(eval export volumes=$($(1).gz_CONTAINER_VOLUMES)) + $(eval export tmpfs=$($(1).gz_CONTAINER_TMPFS)) + $(eval export config_cli_plugin=$($(1).gz_CLI_CONFIG_PLUGIN)) + $(eval export show_cli_plugin=$($(1).gz_CLI_SHOW_PLUGIN)) + j2 $($*.gz_PATH)/Dockerfile.j2 > $($(1).gz_PATH)/Dockerfile + j2 --customize scripts/j2cli/json_filter.py files/build_templates/manifest.json.j2 > $($(1).gz_PATH)/manifest.common.json + if [ -f $($*.gz_PATH)/manifest.part.json.j2 ]; then + j2 --customize scripts/j2cli/json_filter.py $($(1).gz_PATH)/manifest.part.json.j2 > $($(1).gz_PATH)/manifest.part.json + jq -s '.[0] * .[1]' $($(1).gz_PATH)/manifest.common.json $($(1).gz_PATH)/manifest.part.json > $($(1).gz_PATH)/manifest.json + else + mv $($(1).gz_PATH)/manifest.common.json $($(1).gz_PATH)/manifest.json + fi +endef diff --git a/slave.mk b/slave.mk index 9388b1de5a15..2976b34d4269 100644 --- a/slave.mk +++ b/slave.mk @@ -741,23 +741,7 @@ $(addprefix $(TARGET_PATH)/, $(DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .platform $(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_pydebs=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_PYTHON_DEBS)))\n" | awk '!a[$$0]++')) $(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_whls=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_PYTHON_WHEELS)))\n" | awk '!a[$$0]++')) $(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_dbgs=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_DBG_PACKAGES)))\n" | awk '!a[$$0]++')) - $(eval export version=$($*.gz_VERSION)) - $(eval export name=$($*.gz_CONTAINER_NAME)) - $(eval export package_name=$($*.gz_PACKAGE_NAME)) - $(eval export asic_service=$(shell [ -f files/build_templates/per_namespace/$(name).service.j2 ] && echo true || echo false)) - $(eval export host_service=$(shell [ -f files/build_templates/$(name).service.j2 ] && echo true || echo false)) - $(eval export depends=$($*.gz_PACKAGE_DEPENDS)) - $(eval export requires=$($*.gz_SERVICE_REQUIRES)) - $(eval export after=$($*.gz_SERVICE_AFTER)) - $(eval export before=$($*.gz_SERVICE_BEFORE)) - $(eval export dependent_of=$($*.gz_SERVICE_DEPENDENT_OF)) - $(eval export privileged=$($*.gz_CONTAINER_PRIVILEGED)) - $(eval export volumes=$($*.gz_CONTAINER_VOLUMES)) - $(eval export tmpfs=$($*.gz_CONTAINER_TMPFS)) - $(eval export config_cli_plugin=$($*.gz_CLI_CONFIG_PLUGIN)) - $(eval export show_cli_plugin=$($*.gz_CLI_SHOW_PLUGIN)) - j2 $($*.gz_PATH)/Dockerfile.j2 > $($*.gz_PATH)/Dockerfile - j2 --customize scripts/j2cli/json_filter.py files/build_templates/manifest.json.j2 > $($*.gz_PATH)/manifest.json + $(call generate_manifest,$*) # Prepare docker build info PACKAGE_URL_PREFIX=$(PACKAGE_URL_PREFIX) \ SONIC_ENFORCE_VERSIONS=$(SONIC_ENFORCE_VERSIONS) \ @@ -810,6 +794,7 @@ $(addprefix $(TARGET_PATH)/, $(DOCKER_DBG_IMAGES)) : $(TARGET_PATH)/%-$(DBG_IMAG $(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_image_dbgs=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_DBG_IMAGE_PACKAGES)))\n" | awk '!a[$$0]++')) ./build_debug_docker_j2.sh $* $(subst -,_,$(notdir $($*.gz_PATH)))_dbg_debs $(subst -,_,$(notdir $($*.gz_PATH)))_image_dbgs > $($*.gz_PATH)/Dockerfile-dbg.j2 j2 $($*.gz_PATH)/Dockerfile-dbg.j2 > $($*.gz_PATH)/Dockerfile-dbg + $(call generate_manifest,$*,-dbg) # Prepare docker build info PACKAGE_URL_PREFIX=$(PACKAGE_URL_PREFIX) \ SONIC_ENFORCE_VERSIONS=$(SONIC_ENFORCE_VERSIONS) \ @@ -821,6 +806,7 @@ $(addprefix $(TARGET_PATH)/, $(DOCKER_DBG_IMAGES)) : $(TARGET_PATH)/%-$(DBG_IMAG --build-arg http_proxy=$(HTTP_PROXY) \ --build-arg https_proxy=$(HTTPS_PROXY) \ --build-arg docker_container_name=$($*.gz_CONTAINER_NAME) \ + --label com.azure.sonic.manifest="$$(cat $($*.gz_PATH)/manifest.json)" \ --label Tag=$(SONIC_IMAGE_VERSION) \ --file $($*.gz_PATH)/Dockerfile-dbg \ -t $*-dbg $($*.gz_PATH) $(LOG) From 92ad8b1cfcd4ccbdd8b5b965fb5e2c0f9f9f58c0 Mon Sep 17 00:00:00 2001 From: Stepan Blyschak Date: Mon, 12 Apr 2021 23:53:22 +0300 Subject: [PATCH 31/44] add comment Signed-off-by: Stepan Blyschak --- rules/functions | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/rules/functions b/rules/functions index 0a4842ab3a12..4acf75482e92 100644 --- a/rules/functions +++ b/rules/functions @@ -168,9 +168,11 @@ trap "sudo umount $$mergedir && rm -rf $$mergedir $$upperdir $$workdir" EXIT endef -############################################################### +############################################################################### ## Manifest generation routine -### +############################################################### +# call: +# generate_manifest some_docker.gz, version_suffix define generate_manifest $(eval export version=$($(1).gz_VERSION)$(2)) $(eval export name=$($(1).gz_CONTAINER_NAME)) From 57ec2f2723a8e9e8f36fff7f04be96a213cbdd2e Mon Sep 17 00:00:00 2001 From: Stepan Blyschak Date: Thu, 15 Apr 2021 17:53:37 +0300 Subject: [PATCH 32/44] remove not needed ARG in dockerfiles Signed-off-by: Stepan Blyschak --- dockers/docker-database/Dockerfile.j2 | 2 -- dockers/docker-dhcp-relay/Dockerfile.j2 | 2 -- dockers/docker-fpm-frr/Dockerfile.j2 | 2 -- dockers/docker-fpm-gobgp/Dockerfile.j2 | 3 --- dockers/docker-fpm-quagga/Dockerfile.j2 | 2 -- dockers/docker-iccpd/Dockerfile.j2 | 2 -- dockers/docker-lldp/Dockerfile.j2 | 2 -- dockers/docker-macsec/Dockerfile.j2 | 1 - dockers/docker-nat/Dockerfile.j2 | 2 -- dockers/docker-orchagent/Dockerfile.j2 | 2 -- dockers/docker-platform-monitor/Dockerfile.j2 | 2 -- dockers/docker-router-advertiser/Dockerfile.j2 | 2 -- dockers/docker-sflow/Dockerfile.j2 | 2 -- dockers/docker-snmp/Dockerfile.j2 | 2 -- dockers/docker-sonic-mgmt-framework/Dockerfile.j2 | 2 -- dockers/docker-sonic-restapi/Dockerfile.j2 | 2 -- dockers/docker-sonic-telemetry/Dockerfile.j2 | 2 -- dockers/docker-teamd/Dockerfile.j2 | 2 -- platform/barefoot/docker-syncd-bfn/Dockerfile.j2 | 1 - platform/broadcom/docker-syncd-brcm/Dockerfile.j2 | 1 - platform/cavium/docker-syncd-cavm/Dockerfile.j2 | 1 - platform/centec-arm64/docker-syncd-centec/Dockerfile.j2 | 1 - platform/centec/docker-syncd-centec/Dockerfile.j2 | 1 - platform/innovium/docker-syncd-invm/Dockerfile.j2 | 1 - platform/marvell-arm64/docker-syncd-mrvl/Dockerfile.j2 | 1 - platform/marvell-armhf/docker-syncd-mrvl/Dockerfile.j2 | 1 - platform/marvell/docker-syncd-mrvl/Dockerfile.j2 | 1 - platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 | 1 - platform/nephos/docker-syncd-nephos/Dockerfile.j2 | 1 - platform/vs/docker-gbsyncd-vs/Dockerfile.j2 | 1 - platform/vs/docker-syncd-vs/Dockerfile.j2 | 1 - 31 files changed, 49 deletions(-) diff --git a/dockers/docker-database/Dockerfile.j2 b/dockers/docker-database/Dockerfile.j2 index 9debbe2423d3..aef22e24379c 100644 --- a/dockers/docker-database/Dockerfile.j2 +++ b/dockers/docker-database/Dockerfile.j2 @@ -2,8 +2,6 @@ FROM docker-config-engine-buster ARG docker_container_name -ARG manifest - RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf # Make apt-get non-interactive diff --git a/dockers/docker-dhcp-relay/Dockerfile.j2 b/dockers/docker-dhcp-relay/Dockerfile.j2 index 76a1f1c2a055..1100aa510742 100644 --- a/dockers/docker-dhcp-relay/Dockerfile.j2 +++ b/dockers/docker-dhcp-relay/Dockerfile.j2 @@ -3,8 +3,6 @@ FROM docker-config-engine-buster ARG docker_container_name ARG image_version -ARG manifest - RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf # Make apt-get non-interactive diff --git a/dockers/docker-fpm-frr/Dockerfile.j2 b/dockers/docker-fpm-frr/Dockerfile.j2 index bde0812975d2..42df1c6f38f8 100644 --- a/dockers/docker-fpm-frr/Dockerfile.j2 +++ b/dockers/docker-fpm-frr/Dockerfile.j2 @@ -2,8 +2,6 @@ FROM docker-config-engine-buster ARG docker_container_name -ARG manifest - ARG frr_user_uid ARG frr_user_gid diff --git a/dockers/docker-fpm-gobgp/Dockerfile.j2 b/dockers/docker-fpm-gobgp/Dockerfile.j2 index f61f7fb244d5..65b104e43b26 100644 --- a/dockers/docker-fpm-gobgp/Dockerfile.j2 +++ b/dockers/docker-fpm-gobgp/Dockerfile.j2 @@ -1,8 +1,5 @@ FROM docker-fpm-quagga -ARG docker_container_name -ARG manifest - ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/dockers/docker-fpm-quagga/Dockerfile.j2 b/dockers/docker-fpm-quagga/Dockerfile.j2 index 4a34226b022f..ac382afbe5b2 100644 --- a/dockers/docker-fpm-quagga/Dockerfile.j2 +++ b/dockers/docker-fpm-quagga/Dockerfile.j2 @@ -1,8 +1,6 @@ FROM docker-config-engine ARG docker_container_name -ARG manifest - RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf # Make apt-get non-interactive diff --git a/dockers/docker-iccpd/Dockerfile.j2 b/dockers/docker-iccpd/Dockerfile.j2 index 3102bf22c84c..51cc306bdd55 100644 --- a/dockers/docker-iccpd/Dockerfile.j2 +++ b/dockers/docker-iccpd/Dockerfile.j2 @@ -2,8 +2,6 @@ FROM docker-config-engine-buster ARG docker_container_name -ARG manifest - RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf ## Make apt-get non-interactive diff --git a/dockers/docker-lldp/Dockerfile.j2 b/dockers/docker-lldp/Dockerfile.j2 index 076018afe25a..a1c7a1c1bee2 100644 --- a/dockers/docker-lldp/Dockerfile.j2 +++ b/dockers/docker-lldp/Dockerfile.j2 @@ -2,9 +2,7 @@ FROM docker-config-engine-buster ARG docker_container_name -ARG manifest ARG image_version - RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf # Make apt-get non-interactive diff --git a/dockers/docker-macsec/Dockerfile.j2 b/dockers/docker-macsec/Dockerfile.j2 index 9328b2549d19..9bbfd69e8d5b 100644 --- a/dockers/docker-macsec/Dockerfile.j2 +++ b/dockers/docker-macsec/Dockerfile.j2 @@ -2,7 +2,6 @@ FROM docker-config-engine-buster ARG docker_container_name -ARG manifest RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf ## Make apt-get non-interactive diff --git a/dockers/docker-nat/Dockerfile.j2 b/dockers/docker-nat/Dockerfile.j2 index 7ed5d316419b..36a178a68af2 100644 --- a/dockers/docker-nat/Dockerfile.j2 +++ b/dockers/docker-nat/Dockerfile.j2 @@ -2,8 +2,6 @@ FROM docker-config-engine-buster ARG docker_container_name -ARG manifest - RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf RUN echo diff --git a/dockers/docker-orchagent/Dockerfile.j2 b/dockers/docker-orchagent/Dockerfile.j2 index a6553f8d202c..17c0983c58b2 100755 --- a/dockers/docker-orchagent/Dockerfile.j2 +++ b/dockers/docker-orchagent/Dockerfile.j2 @@ -2,8 +2,6 @@ FROM docker-config-engine-buster ARG docker_container_name -ARG manifest - RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf # Make apt-get non-interactive diff --git a/dockers/docker-platform-monitor/Dockerfile.j2 b/dockers/docker-platform-monitor/Dockerfile.j2 index 63086966eed3..e86f4ad0019b 100755 --- a/dockers/docker-platform-monitor/Dockerfile.j2 +++ b/dockers/docker-platform-monitor/Dockerfile.j2 @@ -2,9 +2,7 @@ FROM docker-config-engine-buster ARG docker_container_name -ARG manifest ARG image_version - RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf # Make apt-get non-interactive diff --git a/dockers/docker-router-advertiser/Dockerfile.j2 b/dockers/docker-router-advertiser/Dockerfile.j2 index 81cd447c7007..7d225cbd4e79 100644 --- a/dockers/docker-router-advertiser/Dockerfile.j2 +++ b/dockers/docker-router-advertiser/Dockerfile.j2 @@ -2,9 +2,7 @@ FROM docker-config-engine-buster ARG docker_container_name -ARG manifest ARG image_version - RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf # Make apt-get non-interactive diff --git a/dockers/docker-sflow/Dockerfile.j2 b/dockers/docker-sflow/Dockerfile.j2 index 474785234c0c..476ff3514ace 100644 --- a/dockers/docker-sflow/Dockerfile.j2 +++ b/dockers/docker-sflow/Dockerfile.j2 @@ -2,8 +2,6 @@ FROM docker-config-engine-buster ARG docker_container_name -ARG manifest - RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf ## Make apt-get non-interactive diff --git a/dockers/docker-snmp/Dockerfile.j2 b/dockers/docker-snmp/Dockerfile.j2 index 392e72ab07bc..528189c2014f 100644 --- a/dockers/docker-snmp/Dockerfile.j2 +++ b/dockers/docker-snmp/Dockerfile.j2 @@ -2,9 +2,7 @@ FROM docker-config-engine-buster ARG docker_container_name -ARG manifest ARG image_version - RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf # Enable -O for all Python calls diff --git a/dockers/docker-sonic-mgmt-framework/Dockerfile.j2 b/dockers/docker-sonic-mgmt-framework/Dockerfile.j2 index f937e00f9700..5ee8cae84466 100644 --- a/dockers/docker-sonic-mgmt-framework/Dockerfile.j2 +++ b/dockers/docker-sonic-mgmt-framework/Dockerfile.j2 @@ -1,8 +1,6 @@ FROM docker-config-engine-buster ARG docker_container_name -ARG manifest - RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf ## Make apt-get non-interactive diff --git a/dockers/docker-sonic-restapi/Dockerfile.j2 b/dockers/docker-sonic-restapi/Dockerfile.j2 index 999b33a3bd61..837796e66d82 100644 --- a/dockers/docker-sonic-restapi/Dockerfile.j2 +++ b/dockers/docker-sonic-restapi/Dockerfile.j2 @@ -2,8 +2,6 @@ FROM docker-config-engine-stretch ARG docker_container_name -ARG manifest - RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf ## Make apt-get non-interactive diff --git a/dockers/docker-sonic-telemetry/Dockerfile.j2 b/dockers/docker-sonic-telemetry/Dockerfile.j2 index 87f47d0c5383..88ff94318208 100644 --- a/dockers/docker-sonic-telemetry/Dockerfile.j2 +++ b/dockers/docker-sonic-telemetry/Dockerfile.j2 @@ -2,9 +2,7 @@ FROM docker-config-engine-buster ARG docker_container_name -ARG manifest ARG image_version - RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf ## Make apt-get non-interactive diff --git a/dockers/docker-teamd/Dockerfile.j2 b/dockers/docker-teamd/Dockerfile.j2 index 08963ec45dce..7f4db2936857 100644 --- a/dockers/docker-teamd/Dockerfile.j2 +++ b/dockers/docker-teamd/Dockerfile.j2 @@ -2,8 +2,6 @@ FROM docker-config-engine-buster ARG docker_container_name -ARG manifest - RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf ## Make apt-get non-interactive diff --git a/platform/barefoot/docker-syncd-bfn/Dockerfile.j2 b/platform/barefoot/docker-syncd-bfn/Dockerfile.j2 index baeddf1e6a3a..7071b0c8b51e 100755 --- a/platform/barefoot/docker-syncd-bfn/Dockerfile.j2 +++ b/platform/barefoot/docker-syncd-bfn/Dockerfile.j2 @@ -1,7 +1,6 @@ FROM docker-config-engine-buster ARG docker_container_name -ARG manifest ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 b/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 index 41de1ca063b1..a70e91bb60b8 100755 --- a/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 +++ b/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 @@ -2,7 +2,6 @@ FROM docker-config-engine-buster ARG docker_container_name -ARG manifest RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf diff --git a/platform/cavium/docker-syncd-cavm/Dockerfile.j2 b/platform/cavium/docker-syncd-cavm/Dockerfile.j2 index fb19dc9636d4..8ac883e6293d 100755 --- a/platform/cavium/docker-syncd-cavm/Dockerfile.j2 +++ b/platform/cavium/docker-syncd-cavm/Dockerfile.j2 @@ -1,7 +1,6 @@ FROM docker-config-engine ARG docker_container_name -ARG manifest RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf diff --git a/platform/centec-arm64/docker-syncd-centec/Dockerfile.j2 b/platform/centec-arm64/docker-syncd-centec/Dockerfile.j2 index 8a029150413d..7f89c0c98698 100755 --- a/platform/centec-arm64/docker-syncd-centec/Dockerfile.j2 +++ b/platform/centec-arm64/docker-syncd-centec/Dockerfile.j2 @@ -1,7 +1,6 @@ FROM docker-config-engine-buster ARG docker_container_name -ARG manifest RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf diff --git a/platform/centec/docker-syncd-centec/Dockerfile.j2 b/platform/centec/docker-syncd-centec/Dockerfile.j2 index 6ce34616de00..001e944bb85a 100755 --- a/platform/centec/docker-syncd-centec/Dockerfile.j2 +++ b/platform/centec/docker-syncd-centec/Dockerfile.j2 @@ -1,7 +1,6 @@ FROM docker-config-engine-buster ARG docker_container_name -ARG manifest RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf diff --git a/platform/innovium/docker-syncd-invm/Dockerfile.j2 b/platform/innovium/docker-syncd-invm/Dockerfile.j2 index e11faf04a2db..4bdc7a6ebef1 100755 --- a/platform/innovium/docker-syncd-invm/Dockerfile.j2 +++ b/platform/innovium/docker-syncd-invm/Dockerfile.j2 @@ -1,7 +1,6 @@ FROM docker-config-engine-stretch ARG docker_container_name -ARG manifest RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf diff --git a/platform/marvell-arm64/docker-syncd-mrvl/Dockerfile.j2 b/platform/marvell-arm64/docker-syncd-mrvl/Dockerfile.j2 index 4b5aa878a7e6..6f96738e0d1b 100755 --- a/platform/marvell-arm64/docker-syncd-mrvl/Dockerfile.j2 +++ b/platform/marvell-arm64/docker-syncd-mrvl/Dockerfile.j2 @@ -1,7 +1,6 @@ FROM docker-config-engine-stretch ARG docker_container_name -ARG manifest RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf diff --git a/platform/marvell-armhf/docker-syncd-mrvl/Dockerfile.j2 b/platform/marvell-armhf/docker-syncd-mrvl/Dockerfile.j2 index 4b5aa878a7e6..6f96738e0d1b 100755 --- a/platform/marvell-armhf/docker-syncd-mrvl/Dockerfile.j2 +++ b/platform/marvell-armhf/docker-syncd-mrvl/Dockerfile.j2 @@ -1,7 +1,6 @@ FROM docker-config-engine-stretch ARG docker_container_name -ARG manifest RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf diff --git a/platform/marvell/docker-syncd-mrvl/Dockerfile.j2 b/platform/marvell/docker-syncd-mrvl/Dockerfile.j2 index 45c2fd281525..be69f831720a 100755 --- a/platform/marvell/docker-syncd-mrvl/Dockerfile.j2 +++ b/platform/marvell/docker-syncd-mrvl/Dockerfile.j2 @@ -1,7 +1,6 @@ FROM docker-config-engine-stretch ARG docker_container_name -ARG manifest RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf diff --git a/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 b/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 index f4b81a76b45f..011931b2ff4b 100755 --- a/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 +++ b/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 @@ -2,7 +2,6 @@ FROM docker-config-engine-buster ARG docker_container_name -ARG manifest RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf diff --git a/platform/nephos/docker-syncd-nephos/Dockerfile.j2 b/platform/nephos/docker-syncd-nephos/Dockerfile.j2 index 104e6f29a410..3c7ffa1e49c5 100755 --- a/platform/nephos/docker-syncd-nephos/Dockerfile.j2 +++ b/platform/nephos/docker-syncd-nephos/Dockerfile.j2 @@ -1,7 +1,6 @@ FROM docker-config-engine-stretch ARG docker_container_name -ARG manifest RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf diff --git a/platform/vs/docker-gbsyncd-vs/Dockerfile.j2 b/platform/vs/docker-gbsyncd-vs/Dockerfile.j2 index f2c7e22641bf..a9e7f6f53d2c 100644 --- a/platform/vs/docker-gbsyncd-vs/Dockerfile.j2 +++ b/platform/vs/docker-gbsyncd-vs/Dockerfile.j2 @@ -1,7 +1,6 @@ FROM docker-config-engine-buster ARG docker_container_name -ARG manifest RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf diff --git a/platform/vs/docker-syncd-vs/Dockerfile.j2 b/platform/vs/docker-syncd-vs/Dockerfile.j2 index 093efd0bc05a..7fc6391f365e 100644 --- a/platform/vs/docker-syncd-vs/Dockerfile.j2 +++ b/platform/vs/docker-syncd-vs/Dockerfile.j2 @@ -1,7 +1,6 @@ FROM docker-config-engine-buster ARG docker_container_name -ARG manifest RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf From 7c113124fed3c557ca8ca6523307bcf8209bc03b Mon Sep 17 00:00:00 2001 From: Stepan Blyschak Date: Wed, 21 Apr 2021 15:03:18 +0300 Subject: [PATCH 33/44] tests for cli plugins Signed-off-by: Stepan Blyschak --- .../cli-plugin-tests/conftest.py | 25 +++ .../test_config_dhcp_relay.py | 177 ++++++++++++++++++ .../cli-plugin-tests/test_show_dhcp_relay.py | 40 ++++ .../{dhcp_relay.py => show_dhcp_relay.py} | 4 +- rules/docker-dhcp-relay.mk | 2 +- slave.mk | 8 + 6 files changed, 252 insertions(+), 4 deletions(-) create mode 100644 dockers/docker-dhcp-relay/cli-plugin-tests/conftest.py create mode 100644 dockers/docker-dhcp-relay/cli-plugin-tests/test_config_dhcp_relay.py create mode 100644 dockers/docker-dhcp-relay/cli-plugin-tests/test_show_dhcp_relay.py rename dockers/docker-dhcp-relay/cli/show/plugins/{dhcp_relay.py => show_dhcp_relay.py} (94%) diff --git a/dockers/docker-dhcp-relay/cli-plugin-tests/conftest.py b/dockers/docker-dhcp-relay/cli-plugin-tests/conftest.py new file mode 100644 index 000000000000..e7e1e2bb5d20 --- /dev/null +++ b/dockers/docker-dhcp-relay/cli-plugin-tests/conftest.py @@ -0,0 +1,25 @@ +import pytest + +@pytest.fixture() +def mock_cfgdb(): + cfgdb = mock.Mock() + CONFIG = { + 'VLAN': { + 'Vlan1000': { + 'dhcp_servers': ['192.0.0.1'] + } + } + } + + def get_entry(table, key): + return CONFIG[table][key] + + def set_entry(table, key, data): + CONFIG[table].setdefault(key, {}) + CONFIG[table][key] = data + + cfgdb.get_entry = mock.Mock(side_effect=get_entry) + cfgdb.set_entry = mock.Mock(side_effect=set_entry) + + yield cfgdb + diff --git a/dockers/docker-dhcp-relay/cli-plugin-tests/test_config_dhcp_relay.py b/dockers/docker-dhcp-relay/cli-plugin-tests/test_config_dhcp_relay.py new file mode 100644 index 000000000000..02577b1c47b5 --- /dev/null +++ b/dockers/docker-dhcp-relay/cli-plugin-tests/test_config_dhcp_relay.py @@ -0,0 +1,177 @@ +import os +import sys +import traceback +from unittest import mock + +from click.testing import CliRunner + +import config.main as config +import show.main as show +from utilities_common.db import Db + +import pytest + +sys.path.append('../cli/config/plugins/') +import dhcp_relay + +@pytest.fixture() +def mock_cfgdb(): + cfgdb = mock.Mock() + CONFIG = { + 'VLAN': { + 'Vlan1000': { + 'dhcp_servers': ['192.0.0.1'] + } + } + } + + def get_entry(table, key): + return CONFIG[table][key] + + def set_entry(table, key, data): + CONFIG[table].setdefault(key, {}) + CONFIG[table][key] = data + + cfgdb.get_entry = mock.Mock(side_effect=get_entry) + cfgdb.set_entry = mock.Mock(side_effect=set_entry) + + yield cfgdb + + +config_vlan_add_dhcp_relay_output="""\ +Added DHCP relay destination address 192.0.0.100 to Vlan1000 +Restarting DHCP relay service... +""" + +config_vlan_del_dhcp_relay_output="""\ +Removed DHCP relay destination address 192.0.0.100 from Vlan1000 +Restarting DHCP relay service... +""" + +class TestConfigVlanDhcpRelay(object): + @classmethod + def setup_class(cls): + os.environ['UTILITIES_UNIT_TESTING'] = "1" + print("SETUP") + + @classmethod + def teardown_class(cls): + os.environ['UTILITIES_UNIT_TESTING'] = "0" + print("TEARDOWN") + + def test_plugin_registration(self): + cli = mock.MagicMock() + dhcp_relay.register(cli) + cli.commands['vlan'].add_command.assert_called_once_with(dhcp_relay.vlan_dhcp_relay) + + def test_config_vlan_add_dhcp_relay_with_nonexist_vlanid(self): + runner = CliRunner() + + with mock.patch('utilities_common.cli.run_command') as mock_run_command: + result = runner.invoke(dhcp_relay.vlan_dhcp_relay.commands["add"], + ["1001", "192.0.0.100"]) + print(result.exit_code) + print(result.output) + # traceback.print_tb(result.exc_info[2]) + assert result.exit_code != 0 + assert "Error: Vlan1001 doesn't exist" in result.output + assert mock_run_command.call_count == 0 + + def test_config_vlan_add_dhcp_relay_with_invalid_vlanid(self): + runner = CliRunner() + + with mock.patch('utilities_common.cli.run_command') as mock_run_command: + result = runner.invoke(dhcp_relay.vlan_dhcp_relay.commands["add"], + ["4096", "192.0.0.100"]) + print(result.exit_code) + print(result.output) + # traceback.print_tb(result.exc_info[2]) + assert result.exit_code != 0 + assert "Error: Vlan4096 doesn't exist" in result.output + assert mock_run_command.call_count == 0 + + def test_config_vlan_add_dhcp_relay_with_invalid_ip(self): + runner = CliRunner() + + with mock.patch('utilities_common.cli.run_command') as mock_run_command: + result = runner.invoke(dhcp_relay.vlan_dhcp_relay.commands["add"], + ["1000", "192.0.0.1000"]) + print(result.exit_code) + print(result.output) + # traceback.print_tb(result.exc_info[2]) + assert result.exit_code != 0 + assert "Error: 192.0.0.1000 is invalid IP address" in result.output + assert mock_run_command.call_count == 0 + + def test_config_vlan_add_dhcp_relay_with_exist_ip(self, mock_cfgdb): + runner = CliRunner() + db = Db() + db.cfgdb = mock_cfgdb + + with mock.patch('utilities_common.cli.run_command') as mock_run_command: + result = runner.invoke(dhcp_relay.vlan_dhcp_relay.commands["add"], + ["1000", "192.0.0.1"], obj=db) + print(result.exit_code) + print(result.output) + assert result.exit_code == 0 + assert "192.0.0.1 is already a DHCP relay destination for Vlan1000" in result.output + assert mock_run_command.call_count == 0 + + def test_config_vlan_add_del_dhcp_relay_dest(self, mock_cfgdb): + runner = CliRunner() + db = Db() + db.cfgdb = mock_cfgdb + + # add new relay dest + with mock.patch("utilities_common.cli.run_command") as mock_run_command: + result = runner.invoke(dhcp_relay.vlan_dhcp_relay.commands["add"], + ["1000", "192.0.0.100"], obj=db) + print(result.exit_code) + print(result.output) + assert result.exit_code == 0 + assert result.output == config_vlan_add_dhcp_relay_output + assert mock_run_command.call_count == 3 + db.cfgdb.set_entry.assert_called_once_with('VLAN', 'Vlan1000', {'dhcp_servers': ['192.0.0.1', '192.0.0.100']}) + + db.cfgdb.set_entry.reset_mock() + + # del relay dest + with mock.patch("utilities_common.cli.run_command") as mock_run_command: + result = runner.invoke(config.config.commands["vlan"].commands["dhcp_relay"].commands["del"], + ["1000", "192.0.0.100"], obj=db) + print(result.exit_code) + print(result.output) + assert result.exit_code == 0 + assert result.output == config_vlan_del_dhcp_relay_output + assert mock_run_command.call_count == 3 + db.cfgdb.set_entry.assert_called_once_with('VLAN', 'Vlan1000', {'dhcp_servers': ['192.0.0.1']}) + + def test_config_vlan_remove_nonexist_dhcp_relay_dest(self, mock_cfgdb): + runner = CliRunner() + db = Db() + db.cfgdb = mock_cfgdb + + with mock.patch('utilities_common.cli.run_command') as mock_run_command: + result = runner.invoke(config.config.commands["vlan"].commands["dhcp_relay"].commands["del"], + ["1000", "192.0.0.100"], obj=db) + print(result.exit_code) + print(result.output) + # traceback.print_tb(result.exc_info[2]) + assert result.exit_code != 0 + assert "Error: 192.0.0.100 is not a DHCP relay destination for Vlan1000" in result.output + assert mock_run_command.call_count == 0 + + def test_config_vlan_remove_dhcp_relay_dest_with_nonexist_vlanid(self, mock_cfgdb): + runner = CliRunner() + db = Db() + db.cfgdb = mock_cfgdb + + with mock.patch('utilities_common.cli.run_command') as mock_run_command: + result = runner.invoke(config.config.commands["vlan"].commands["dhcp_relay"].commands["del"], + ["1001", "192.0.0.1"], obj=Db) + print(result.exit_code) + print(result.output) + # traceback.print_tb(result.exc_info[2]) + assert result.exit_code != 0 + assert "Error: Vlan1001 doesn't exist" in result.output + assert mock_run_command.call_count == 0 diff --git a/dockers/docker-dhcp-relay/cli-plugin-tests/test_show_dhcp_relay.py b/dockers/docker-dhcp-relay/cli-plugin-tests/test_show_dhcp_relay.py new file mode 100644 index 000000000000..e817a1b76e4c --- /dev/null +++ b/dockers/docker-dhcp-relay/cli-plugin-tests/test_show_dhcp_relay.py @@ -0,0 +1,40 @@ +import os +import sys +import traceback +from unittest import mock + +from click.testing import CliRunner + +import config.main as config +import show.main as show +import show.vlan as vlan +from utilities_common.db import Db + +sys.path.insert(0, '../cli/show/plugins/') +import show_dhcp_relay + + +class TestVlanDhcpRelay(object): + @classmethod + def setup_class(cls): + os.environ['UTILITIES_UNIT_TESTING'] = "1" + print("SETUP") + + @classmethod + def teardown_class(cls): + os.environ['UTILITIES_UNIT_TESTING'] = "0" + print("TEARDOWN") + + def test_plugin_registration(self): + cli = mock.MagicMock() + show_dhcp_relay.register(cli) + assert 'DHCP Helper Address' in dict(vlan.VlanBrief.COLUMNS) + + def test_dhcp_relay_column_output(self): + ctx = ( + ({'Vlan100': {'dhcp_servers': ['192.0.0.1', '192.168.0.2']}}, {}, {}), + (), + ) + assert show_dhcp_relay.get_dhcp_helper_address(ctx, 'Vlan100') == '192.0.0.1\n192.168.0.2' + + diff --git a/dockers/docker-dhcp-relay/cli/show/plugins/dhcp_relay.py b/dockers/docker-dhcp-relay/cli/show/plugins/show_dhcp_relay.py similarity index 94% rename from dockers/docker-dhcp-relay/cli/show/plugins/dhcp_relay.py rename to dockers/docker-dhcp-relay/cli/show/plugins/show_dhcp_relay.py index ba7e086297d9..ae8c453e45f3 100644 --- a/dockers/docker-dhcp-relay/cli/show/plugins/dhcp_relay.py +++ b/dockers/docker-dhcp-relay/cli/show/plugins/show_dhcp_relay.py @@ -1,6 +1,5 @@ from natsort import natsorted -from .. import vlan - +import show.vlan as vlan def get_dhcp_helper_address(ctx, vlan): cfg, _ = ctx @@ -19,4 +18,3 @@ def get_dhcp_helper_address(ctx, vlan): def register(cli): pass - diff --git a/rules/docker-dhcp-relay.mk b/rules/docker-dhcp-relay.mk index 807d13bb0b17..633d96eafc71 100644 --- a/rules/docker-dhcp-relay.mk +++ b/rules/docker-dhcp-relay.mk @@ -47,6 +47,6 @@ $(DOCKER_DHCP_RELAY)_CONTAINER_TMPFS += /tmp/ $(DOCKER_DHCP_RELAY)_CONTAINER_TMPFS += /var/tmp/ $(DOCKER_DHCP_RELAY)_CLI_CONFIG_PLUGIN = /cli/config/plugins/dhcp_relay.py -$(DOCKER_DHCP_RELAY)_CLI_SHOW_PLUGIN = /cli/show/plugins/dhcp_relay.py +$(DOCKER_DHCP_RELAY)_CLI_SHOW_PLUGIN = /cli/show/plugins/show_dhcp_relay.py $(DOCKER_DHCP_RELAY)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT) diff --git a/slave.mk b/slave.mk index be13a0cd5dd5..41c41237e9c6 100644 --- a/slave.mk +++ b/slave.mk @@ -723,6 +723,7 @@ $(addprefix $(TARGET_PATH)/, $(DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .platform $$(addprefix $(PYTHON_WHEELS_PATH)/,$$($$*.gz_PYTHON_WHEELS)) \ $$(addsuffix -load,$$(addprefix $(TARGET_PATH)/,$$($$*.gz_LOAD_DOCKERS))) \ $$($$*.gz_PATH)/Dockerfile.j2 \ + $(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_UTILITIES_PY3)-install) \ $(call dpkg_depend,$(TARGET_PATH)/%.gz.dep) $(HEADER) @@ -747,6 +748,13 @@ $(addprefix $(TARGET_PATH)/, $(DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .platform $(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_pydebs=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_PYTHON_DEBS)))\n" | awk '!a[$$0]++')) $(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_whls=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_PYTHON_WHEELS)))\n" | awk '!a[$$0]++')) $(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_dbgs=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_DBG_PACKAGES)))\n" | awk '!a[$$0]++')) + if [ ! "$($*_TEST)" = "n" ]; then + if [ -f $($*.gz_PATH)/cli-plugin-tests/ ]; then + pushd $($*.gz_PATH)/cli-plugin-tests; + pytest-$($(SONIC_UTILITIES_PY3)_PYTHON_VERSION) -v $(LOG); + popd; + fi + fi $(call generate_manifest,$*) # Prepare docker build info PACKAGE_URL_PREFIX=$(PACKAGE_URL_PREFIX) \ From 662aa3dbd74de09b3b0e105a8f77d89f5808be6d Mon Sep 17 00:00:00 2001 From: Stepan Blyschak Date: Wed, 21 Apr 2021 17:39:57 +0300 Subject: [PATCH 34/44] add tests Signed-off-by: Stepan Blyschak --- .../cli-plugin-tests/conftest.py | 1 + .../cli-plugin-tests/mock_tables.py | 155 ++++++++++++++++++ .../test_config_dhcp_relay.py | 8 +- .../cli-plugin-tests/test_show_dhcp_relay.py | 2 - slave.mk | 10 +- 5 files changed, 162 insertions(+), 14 deletions(-) create mode 100644 dockers/docker-dhcp-relay/cli-plugin-tests/mock_tables.py diff --git a/dockers/docker-dhcp-relay/cli-plugin-tests/conftest.py b/dockers/docker-dhcp-relay/cli-plugin-tests/conftest.py index e7e1e2bb5d20..7ffc316d7fbc 100644 --- a/dockers/docker-dhcp-relay/cli-plugin-tests/conftest.py +++ b/dockers/docker-dhcp-relay/cli-plugin-tests/conftest.py @@ -1,4 +1,5 @@ import pytest +import mock_tables @pytest.fixture() def mock_cfgdb(): diff --git a/dockers/docker-dhcp-relay/cli-plugin-tests/mock_tables.py b/dockers/docker-dhcp-relay/cli-plugin-tests/mock_tables.py new file mode 100644 index 000000000000..30a9f5a6539b --- /dev/null +++ b/dockers/docker-dhcp-relay/cli-plugin-tests/mock_tables.py @@ -0,0 +1,155 @@ +# MONKEY PATCH!!! +import json +import os +import sys +from unittest import mock + +import mockredis +import redis +import swsssdk +from sonic_py_common import multi_asic +from swsssdk import SonicDBConfig, SonicV2Connector, ConfigDBConnector, ConfigDBPipeConnector +from swsscommon import swsscommon + + +topo = None +dedicated_dbs = {} + +def clean_up_config(): + # Set SonicDBConfig variables to initial state + # so that it can be loaded with single or multiple + # namespaces before the test begins. + SonicDBConfig._sonic_db_config = {} + SonicDBConfig._sonic_db_global_config_init = False + SonicDBConfig._sonic_db_config_init = False + +def load_namespace_config(): + # To support multi asic testing + # SonicDBConfig load_sonic_global_db_config + # is invoked to load multiple namespaces + clean_up_config() + SonicDBConfig.load_sonic_global_db_config( + global_db_file_path=os.path.join( + os.path.dirname(os.path.abspath(__file__)), 'database_global.json')) + +def load_database_config(): + # Load local database_config.json for single namespace test scenario + clean_up_config() + SonicDBConfig.load_sonic_db_config( + sonic_db_file_path=os.path.join( + os.path.dirname(os.path.abspath(__file__)), 'database_config.json')) + + +_old_connect_SonicV2Connector = SonicV2Connector.connect + +def connect_SonicV2Connector(self, db_name, retry_on=True): + # add topo to kwargs for testing different topology + self.dbintf.redis_kwargs['topo'] = topo + # add the namespace to kwargs for testing multi asic + self.dbintf.redis_kwargs['namespace'] = self.namespace + # Mock DB filename for unit-test + global dedicated_dbs + if dedicated_dbs and dedicated_dbs.get(db_name): + self.dbintf.redis_kwargs['db_name'] = dedicated_dbs[db_name] + else: + self.dbintf.redis_kwargs['db_name'] = db_name + self.dbintf.redis_kwargs['decode_responses'] = True + _old_connect_SonicV2Connector(self, db_name, retry_on) + +def _subscribe_keyspace_notification(self, db_name, client): + pass + + +def config_set(self, *args): + pass + + +class MockPubSub: + def get_message(self): + return None + + def psubscribe(self, *args, **kwargs): + pass + + def __call__(self, *args, **kwargs): + return self + + def listen(self): + return [] + + def punsubscribe(self, *args, **kwargs): + pass + + def clear(self): + pass + +INPUT_DIR = os.path.dirname(os.path.abspath(__file__)) + + +class SwssSyncClient(mockredis.MockRedis): + def __init__(self, *args, **kwargs): + super(SwssSyncClient, self).__init__(strict=True, *args, **kwargs) + # Namespace is added in kwargs specifically for unit-test + # to identify the file path to load the db json files. + topo = kwargs.pop('topo') + namespace = kwargs.pop('namespace') + db_name = kwargs.pop('db_name') + self.decode_responses = kwargs.pop('decode_responses', False) == True + fname = db_name.lower() + ".json" + self.pubsub = MockPubSub() + + if namespace is not None and namespace is not multi_asic.DEFAULT_NAMESPACE: + fname = os.path.join(INPUT_DIR, namespace, fname) + elif topo is not None: + fname = os.path.join(INPUT_DIR, topo, fname) + else: + fname = os.path.join(INPUT_DIR, fname) + + if os.path.exists(fname): + with open(fname) as f: + js = json.load(f) + for k, v in js.items(): + if 'expireat' in v and 'ttl' in v and 'type' in v and 'value' in v: + # database is in redis-dump format + if v['type'] == 'hash': + # ignore other types for now since sonic has hset keys only in the db + for attr, value in v['value'].items(): + self.hset(k, attr, value) + else: + for attr, value in v.items(): + self.hset(k, attr, value) + + # Patch mockredis/mockredis/client.py + # The offical implementation assume decode_responses=False + # Here we detect the option and decode after doing encode + def _encode(self, value): + "Return a bytestring representation of the value. Taken from redis-py connection.py" + + value = super(SwssSyncClient, self)._encode(value) + + if self.decode_responses: + return value.decode('utf-8') + + # Patch mockredis/mockredis/client.py + # The official implementation will filter out keys with a slash '/' + # ref: https://github.com/locationlabs/mockredis/blob/master/mockredis/client.py + def keys(self, pattern='*'): + """Emulate keys.""" + import fnmatch + import re + + # Make regex out of glob styled pattern. + regex = fnmatch.translate(pattern) + regex = re.compile(regex) + + # Find every key that matches the pattern + return [key for key in self.redis if regex.match(key)] + + +swsssdk.interface.DBInterface._subscribe_keyspace_notification = _subscribe_keyspace_notification +mockredis.MockRedis.config_set = config_set +redis.StrictRedis = SwssSyncClient +SonicV2Connector.connect = connect_SonicV2Connector +swsscommon.SonicV2Connector = SonicV2Connector +swsscommon.ConfigDBConnector = ConfigDBConnector +swsscommon.ConfigDBPipeConnector = ConfigDBPipeConnector diff --git a/dockers/docker-dhcp-relay/cli-plugin-tests/test_config_dhcp_relay.py b/dockers/docker-dhcp-relay/cli-plugin-tests/test_config_dhcp_relay.py index 02577b1c47b5..fdeb4eab8b47 100644 --- a/dockers/docker-dhcp-relay/cli-plugin-tests/test_config_dhcp_relay.py +++ b/dockers/docker-dhcp-relay/cli-plugin-tests/test_config_dhcp_relay.py @@ -5,8 +5,6 @@ from click.testing import CliRunner -import config.main as config -import show.main as show from utilities_common.db import Db import pytest @@ -137,7 +135,7 @@ def test_config_vlan_add_del_dhcp_relay_dest(self, mock_cfgdb): # del relay dest with mock.patch("utilities_common.cli.run_command") as mock_run_command: - result = runner.invoke(config.config.commands["vlan"].commands["dhcp_relay"].commands["del"], + result = runner.invoke(dhcp_relay.vlan_dhcp_relay.commands["del"], ["1000", "192.0.0.100"], obj=db) print(result.exit_code) print(result.output) @@ -152,7 +150,7 @@ def test_config_vlan_remove_nonexist_dhcp_relay_dest(self, mock_cfgdb): db.cfgdb = mock_cfgdb with mock.patch('utilities_common.cli.run_command') as mock_run_command: - result = runner.invoke(config.config.commands["vlan"].commands["dhcp_relay"].commands["del"], + result = runner.invoke(dhcp_relay.vlan_dhcp_relay.commands["del"], ["1000", "192.0.0.100"], obj=db) print(result.exit_code) print(result.output) @@ -167,7 +165,7 @@ def test_config_vlan_remove_dhcp_relay_dest_with_nonexist_vlanid(self, mock_cfgd db.cfgdb = mock_cfgdb with mock.patch('utilities_common.cli.run_command') as mock_run_command: - result = runner.invoke(config.config.commands["vlan"].commands["dhcp_relay"].commands["del"], + result = runner.invoke(dhcp_relay.vlan_dhcp_relay.commands["del"], ["1001", "192.0.0.1"], obj=Db) print(result.exit_code) print(result.output) diff --git a/dockers/docker-dhcp-relay/cli-plugin-tests/test_show_dhcp_relay.py b/dockers/docker-dhcp-relay/cli-plugin-tests/test_show_dhcp_relay.py index e817a1b76e4c..1534c2f942e6 100644 --- a/dockers/docker-dhcp-relay/cli-plugin-tests/test_show_dhcp_relay.py +++ b/dockers/docker-dhcp-relay/cli-plugin-tests/test_show_dhcp_relay.py @@ -5,8 +5,6 @@ from click.testing import CliRunner -import config.main as config -import show.main as show import show.vlan as vlan from utilities_common.db import Db diff --git a/slave.mk b/slave.mk index 41c41237e9c6..4f95345e62ba 100644 --- a/slave.mk +++ b/slave.mk @@ -724,6 +724,8 @@ $(addprefix $(TARGET_PATH)/, $(DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .platform $$(addsuffix -load,$$(addprefix $(TARGET_PATH)/,$$($$*.gz_LOAD_DOCKERS))) \ $$($$*.gz_PATH)/Dockerfile.j2 \ $(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_UTILITIES_PY3)-install) \ + $(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_UTILITIES_PY3)-install) \ + $(addprefix $(DEBS_PATH)/,$(PYTHON3_SWSSCOMMON)-install) \ $(call dpkg_depend,$(TARGET_PATH)/%.gz.dep) $(HEADER) @@ -748,13 +750,7 @@ $(addprefix $(TARGET_PATH)/, $(DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .platform $(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_pydebs=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_PYTHON_DEBS)))\n" | awk '!a[$$0]++')) $(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_whls=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_PYTHON_WHEELS)))\n" | awk '!a[$$0]++')) $(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_dbgs=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_DBG_PACKAGES)))\n" | awk '!a[$$0]++')) - if [ ! "$($*_TEST)" = "n" ]; then - if [ -f $($*.gz_PATH)/cli-plugin-tests/ ]; then - pushd $($*.gz_PATH)/cli-plugin-tests; - pytest-$($(SONIC_UTILITIES_PY3)_PYTHON_VERSION) -v $(LOG); - popd; - fi - fi + if [ -d $($*.gz_PATH)/cli-plugin-tests/ ]; then pushd $($*.gz_PATH)/cli-plugin-tests; pytest-$($(SONIC_UTILITIES_PY3)_PYTHON_VERSION) -v $(LOG); popd; fi $(call generate_manifest,$*) # Prepare docker build info PACKAGE_URL_PREFIX=$(PACKAGE_URL_PREFIX) \ From 66e23334386252406a6b252e221c9bec1f56a04a Mon Sep 17 00:00:00 2001 From: Stepan Blyschak Date: Thu, 29 Apr 2021 12:44:57 +0300 Subject: [PATCH 35/44] default-owner to set-owner Signed-off-by: Stepan Blyschak --- files/build_templates/sonic_debian_extension.j2 | 14 +++++++------- slave.mk | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index fd7966d44d25..ee13fc5c11d4 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -654,10 +654,10 @@ sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT docker pull k8s.gcr echo "docker images pull complete" {% endif %} -{% macro get_install_options(default_owner, enabled) -%} +{% macro get_install_options(set_owner, enabled) -%} {% set args = ["-y", "-v", "DEBUG"] -%} -{% if default_owner -%} -{% set args = args + ["--default-owner", default_owner] -%} +{% if set_owner -%} +{% set args = args + ["--set-owner", set_owner] -%} {% endif -%} {% if enabled == "y" -%} {% set args = args + ["--enable"] -%} @@ -666,14 +666,14 @@ echo "docker images pull complete" {% endmacro -%} {% for package in sonic_packages.strip().split() -%} -{% set name, repo, version, default_owner, enabled = package.split('|') -%} +{% set name, repo, version, set_owner, enabled = package.split('|') -%} sudo LANG=C chroot $FILESYSTEM_ROOT sonic-package-manager repository add {{ name }} {{ repo }} -sudo LANG=C chroot $FILESYSTEM_ROOT sonic-package-manager install {{ name }}=={{ version }} {{ get_install_options(default_owner, enabled) }} +sudo LANG=C chroot $FILESYSTEM_ROOT sonic-package-manager install {{ name }}=={{ version }} {{ get_install_options(set_owner, enabled) }} {% endfor -%} {% for package in sonic_local_packages.strip().split() -%} -{% set name, path, default_owner, enabled = package.split('|') -%} -sudo LANG=C chroot $FILESYSTEM_ROOT sonic-package-manager install --from-tarball {{ path }} {{ get_install_options(default_owner, enabled) }} +{% set name, path, set_owner, enabled = package.split('|') -%} +sudo LANG=C chroot $FILESYSTEM_ROOT sonic-package-manager install --from-tarball {{ path }} {{ get_install_options(set_owner, enabled) }} {% endfor -%} sudo umount $FILESYSTEM_ROOT/target diff --git a/slave.mk b/slave.mk index c8ab18d667d4..10bc6d4679ec 100644 --- a/slave.mk +++ b/slave.mk @@ -751,7 +751,7 @@ $(addprefix $(TARGET_PATH)/, $(DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .platform $(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_whls=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_PYTHON_WHEELS)))\n" | awk '!a[$$0]++')) $(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_dbgs=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_DBG_PACKAGES)))\n" | awk '!a[$$0]++')) $(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_pkgs=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_APT_PACKAGES)))\n" | awk '!a[$$0]++')) - if [ -d $($*.gz_PATH)/cli-plugin-tests/ ]; then pushd $($*.gz_PATH)/cli-plugin-tests; pytest-$($(SONIC_UTILITIES_PY3)_PYTHON_VERSION) -v $(LOG); popd; fi + if [ -d $($*.gz_PATH)/cli-plugin-tests/ ]; then pushd $($*.gz_PATH)/cli-plugin-tests; pytest-$($(SONIC_UTILITIES_PY3)_PYTHON_VERSION) -v $(LOG); popd; fi j2 $($*.gz_PATH)/Dockerfile.j2 > $($*.gz_PATH)/Dockerfile $(call generate_manifest,$*) # Prepare docker build info From 60076edf442530dfe1a25ebdddca9efadeeb67d1 Mon Sep 17 00:00:00 2001 From: Stepan Blyschak Date: Fri, 30 Apr 2021 05:51:48 +0300 Subject: [PATCH 36/44] fix lgtm warnings Signed-off-by: Stepan Blyschak --- dockers/docker-dhcp-relay/cli-plugin-tests/conftest.py | 2 +- dockers/docker-dhcp-relay/cli-plugin-tests/mock_tables.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/dockers/docker-dhcp-relay/cli-plugin-tests/conftest.py b/dockers/docker-dhcp-relay/cli-plugin-tests/conftest.py index 7ffc316d7fbc..3f3044cb2b43 100644 --- a/dockers/docker-dhcp-relay/cli-plugin-tests/conftest.py +++ b/dockers/docker-dhcp-relay/cli-plugin-tests/conftest.py @@ -1,5 +1,5 @@ import pytest -import mock_tables +import mock_tables # lgtm [py/unused-import] @pytest.fixture() def mock_cfgdb(): diff --git a/dockers/docker-dhcp-relay/cli-plugin-tests/mock_tables.py b/dockers/docker-dhcp-relay/cli-plugin-tests/mock_tables.py index 30a9f5a6539b..650d2cf489e1 100644 --- a/dockers/docker-dhcp-relay/cli-plugin-tests/mock_tables.py +++ b/dockers/docker-dhcp-relay/cli-plugin-tests/mock_tables.py @@ -1,7 +1,6 @@ # MONKEY PATCH!!! import json import os -import sys from unittest import mock import mockredis From 0d5b19eb5f19d72047bf8134e67ccf39351a89c8 Mon Sep 17 00:00:00 2001 From: Stepan Blyschak Date: Wed, 5 May 2021 15:15:43 +0000 Subject: [PATCH 37/44] fix review comments Signed-off-by: Stepan Blyschak --- .../test_config_dhcp_relay.py | 36 +------------------ .../cli-plugin-tests/test_show_dhcp_relay.py | 12 +------ 2 files changed, 2 insertions(+), 46 deletions(-) diff --git a/dockers/docker-dhcp-relay/cli-plugin-tests/test_config_dhcp_relay.py b/dockers/docker-dhcp-relay/cli-plugin-tests/test_config_dhcp_relay.py index fdeb4eab8b47..8a47f6994b80 100644 --- a/dockers/docker-dhcp-relay/cli-plugin-tests/test_config_dhcp_relay.py +++ b/dockers/docker-dhcp-relay/cli-plugin-tests/test_config_dhcp_relay.py @@ -12,30 +12,6 @@ sys.path.append('../cli/config/plugins/') import dhcp_relay -@pytest.fixture() -def mock_cfgdb(): - cfgdb = mock.Mock() - CONFIG = { - 'VLAN': { - 'Vlan1000': { - 'dhcp_servers': ['192.0.0.1'] - } - } - } - - def get_entry(table, key): - return CONFIG[table][key] - - def set_entry(table, key, data): - CONFIG[table].setdefault(key, {}) - CONFIG[table][key] = data - - cfgdb.get_entry = mock.Mock(side_effect=get_entry) - cfgdb.set_entry = mock.Mock(side_effect=set_entry) - - yield cfgdb - - config_vlan_add_dhcp_relay_output="""\ Added DHCP relay destination address 192.0.0.100 to Vlan1000 Restarting DHCP relay service... @@ -47,16 +23,6 @@ def set_entry(table, key, data): """ class TestConfigVlanDhcpRelay(object): - @classmethod - def setup_class(cls): - os.environ['UTILITIES_UNIT_TESTING'] = "1" - print("SETUP") - - @classmethod - def teardown_class(cls): - os.environ['UTILITIES_UNIT_TESTING'] = "0" - print("TEARDOWN") - def test_plugin_registration(self): cli = mock.MagicMock() dhcp_relay.register(cli) @@ -130,7 +96,7 @@ def test_config_vlan_add_del_dhcp_relay_dest(self, mock_cfgdb): assert result.output == config_vlan_add_dhcp_relay_output assert mock_run_command.call_count == 3 db.cfgdb.set_entry.assert_called_once_with('VLAN', 'Vlan1000', {'dhcp_servers': ['192.0.0.1', '192.0.0.100']}) - + db.cfgdb.set_entry.reset_mock() # del relay dest diff --git a/dockers/docker-dhcp-relay/cli-plugin-tests/test_show_dhcp_relay.py b/dockers/docker-dhcp-relay/cli-plugin-tests/test_show_dhcp_relay.py index 1534c2f942e6..b8219fcc6ad3 100644 --- a/dockers/docker-dhcp-relay/cli-plugin-tests/test_show_dhcp_relay.py +++ b/dockers/docker-dhcp-relay/cli-plugin-tests/test_show_dhcp_relay.py @@ -13,16 +13,6 @@ class TestVlanDhcpRelay(object): - @classmethod - def setup_class(cls): - os.environ['UTILITIES_UNIT_TESTING'] = "1" - print("SETUP") - - @classmethod - def teardown_class(cls): - os.environ['UTILITIES_UNIT_TESTING'] = "0" - print("TEARDOWN") - def test_plugin_registration(self): cli = mock.MagicMock() show_dhcp_relay.register(cli) @@ -34,5 +24,5 @@ def test_dhcp_relay_column_output(self): (), ) assert show_dhcp_relay.get_dhcp_helper_address(ctx, 'Vlan100') == '192.0.0.1\n192.168.0.2' - + From dffcee0adca4463ec0d1472e83c438291ffff73a Mon Sep 17 00:00:00 2001 From: stepanb Date: Fri, 7 May 2021 09:14:57 +0000 Subject: [PATCH 38/44] add coverage report Signed-off-by: Stepan Blyschak --- dockers/docker-dhcp-relay/cli-plugin-tests/conftest.py | 1 + dockers/docker-dhcp-relay/cli-plugin-tests/pytest.ini | 3 +++ 2 files changed, 4 insertions(+) create mode 100644 dockers/docker-dhcp-relay/cli-plugin-tests/pytest.ini diff --git a/dockers/docker-dhcp-relay/cli-plugin-tests/conftest.py b/dockers/docker-dhcp-relay/cli-plugin-tests/conftest.py index 3f3044cb2b43..4eb79edd0b60 100644 --- a/dockers/docker-dhcp-relay/cli-plugin-tests/conftest.py +++ b/dockers/docker-dhcp-relay/cli-plugin-tests/conftest.py @@ -1,5 +1,6 @@ import pytest import mock_tables # lgtm [py/unused-import] +from unittest import mock @pytest.fixture() def mock_cfgdb(): diff --git a/dockers/docker-dhcp-relay/cli-plugin-tests/pytest.ini b/dockers/docker-dhcp-relay/cli-plugin-tests/pytest.ini new file mode 100644 index 000000000000..b960c46f4109 --- /dev/null +++ b/dockers/docker-dhcp-relay/cli-plugin-tests/pytest.ini @@ -0,0 +1,3 @@ +[pytest] +addopts = --cov-config=.coveragerc --cov --cov-report html --cov-report term --cov-report xml --junitxml=test-results.xml -vv + From c1f7e32dda27315d45aab3b582fbd72cc804e36e Mon Sep 17 00:00:00 2001 From: Stepan Blyschak Date: Wed, 12 May 2021 15:54:20 +0300 Subject: [PATCH 39/44] [sonic-app-ext] support app extensions installation during build Signed-off-by: Stepan Blyschak --- .../build_templates/sonic_debian_extension.j2 | 22 +++++++++++++++++++ files/scripts/swss.sh | 11 +++++++++- rules/sonic-packages.mk | 9 ++++++++ slave.mk | 18 +++++++++++++-- 4 files changed, 57 insertions(+), 3 deletions(-) create mode 100644 rules/sonic-packages.mk diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 274019215bec..ee13fc5c11d4 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -654,6 +654,28 @@ sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT docker pull k8s.gcr echo "docker images pull complete" {% endif %} +{% macro get_install_options(set_owner, enabled) -%} +{% set args = ["-y", "-v", "DEBUG"] -%} +{% if set_owner -%} +{% set args = args + ["--set-owner", set_owner] -%} +{% endif -%} +{% if enabled == "y" -%} +{% set args = args + ["--enable"] -%} +{% endif -%} +{{ args | join(' ') }} +{% endmacro -%} + +{% for package in sonic_packages.strip().split() -%} +{% set name, repo, version, set_owner, enabled = package.split('|') -%} +sudo LANG=C chroot $FILESYSTEM_ROOT sonic-package-manager repository add {{ name }} {{ repo }} +sudo LANG=C chroot $FILESYSTEM_ROOT sonic-package-manager install {{ name }}=={{ version }} {{ get_install_options(set_owner, enabled) }} +{% endfor -%} + +{% for package in sonic_local_packages.strip().split() -%} +{% set name, path, set_owner, enabled = package.split('|') -%} +sudo LANG=C chroot $FILESYSTEM_ROOT sonic-package-manager install --from-tarball {{ path }} {{ get_install_options(set_owner, enabled) }} +{% endfor -%} + sudo umount $FILESYSTEM_ROOT/target sudo rm -r $FILESYSTEM_ROOT/target if [ $MULTIARCH_QEMU_ENVIRON == y ]; then diff --git a/files/scripts/swss.sh b/files/scripts/swss.sh index 97e50cb975e7..8c280b38d8ea 100755 --- a/files/scripts/swss.sh +++ b/files/scripts/swss.sh @@ -1,8 +1,17 @@ #!/bin/bash -DEPENDENT="radv dhcp_relay" +DEPENDENT="radv" MULTI_INST_DEPENDENT="teamd" +# Update dependent list based on other packages requirements +if [[ -f /etc/sonic/${SERVICE}_dependent ]]; then + DEPENDENT="${DEPENDENT} $(cat /etc/sonic/${SERVICE}_dependent)" +fi + +if [[ -f /etc/sonic/${SERVICE}_multi_inst_dependent ]]; then + MULTI_INST_DEPENDENT="${MULTI_INST_DEPENDENT} cat /etc/sonic/${SERVICE}_multi_inst_dependent" +fi + function debug() { /usr/bin/logger $1 diff --git a/rules/sonic-packages.mk b/rules/sonic-packages.mk new file mode 100644 index 000000000000..47e02001f93b --- /dev/null +++ b/rules/sonic-packages.mk @@ -0,0 +1,9 @@ +# rules to define remote packages that need to be installed +# during SONiC image build + +## Example: +## PACKAGE = my-package +## $(PACKAGE)_REPOSITORY = myrepo/mypackage +## $(PACKAGE)_VERSION = 1.0.0 +## SONIC_PACKAGES += $(PACKAGE) + diff --git a/slave.mk b/slave.mk index 9cce5392cc2c..b249c33edbb7 100644 --- a/slave.mk +++ b/slave.mk @@ -722,6 +722,9 @@ $(addprefix $(TARGET_PATH)/, $(DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .platform $$(addprefix $(PYTHON_WHEELS_PATH)/,$$($$*.gz_PYTHON_WHEELS)) \ $$(addsuffix -load,$$(addprefix $(TARGET_PATH)/,$$($$*.gz_LOAD_DOCKERS))) \ $$($$*.gz_PATH)/Dockerfile.j2 \ + $(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_UTILITIES_PY3)-install) \ + $(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_UTILITIES_PY3)-install) \ + $(addprefix $(DEBS_PATH)/,$(PYTHON3_SWSSCOMMON)-install) \ $(call dpkg_depend,$(TARGET_PATH)/%.gz.dep) $(HEADER) @@ -747,6 +750,7 @@ $(addprefix $(TARGET_PATH)/, $(DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .platform $(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_whls=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_PYTHON_WHEELS)))\n" | awk '!a[$$0]++')) $(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_dbgs=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_DBG_PACKAGES)))\n" | awk '!a[$$0]++')) $(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_pkgs=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_APT_PACKAGES)))\n" | awk '!a[$$0]++')) + if [ -d $($*.gz_PATH)/cli-plugin-tests/ ]; then pushd $($*.gz_PATH)/cli-plugin-tests; pytest-$($(SONIC_UTILITIES_PY3)_PYTHON_VERSION) -v $(LOG); popd; fi j2 $($*.gz_PATH)/Dockerfile.j2 > $($*.gz_PATH)/Dockerfile $(call generate_manifest,$*) # Prepare docker build info @@ -873,6 +877,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ $(SONIC_UTILITIES_DATA) \ $(SONIC_HOST_SERVICES_DATA)) \ $$(addprefix $(TARGET_PATH)/,$$($$*_DOCKERS)) \ + $$(addprefix $(TARGET_PATH)/,$$(SONIC_PACKAGES_LOCAL)) \ $$(addprefix $(FILES_PATH)/,$$($$*_FILES)) \ $(if $(findstring y,$(ENABLE_ZTP)),$(addprefix $(IMAGE_DISTRO_DEBS_PATH)/,$(SONIC_ZTP))) \ $(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_UTILITIES_PY3)) \ @@ -923,8 +928,17 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ export lazy_installer_debs="$(foreach deb, $($*_LAZY_INSTALLS),$(foreach device, $($(deb)_PLATFORM),$(addprefix $(device)@, $(IMAGE_DISTRO_DEBS_PATH)/$(deb))))" export installer_images="$(foreach docker, $($*_DOCKERS),\ $(addprefix $($(docker)_PACKAGE_NAME)|,\ - $(addprefix $($(docker)_PATH)|,\ - $(addprefix $(TARGET_PATH)/,$(addsuffix :$($(docker)_VERSION),$(docker))))))" + $(addprefix $($(docker)_PATH)|,\ + $(addprefix $(TARGET_PATH)/,$(addsuffix :$($(docker)_VERSION),$(docker))))))" + export sonic_packages="$(foreach package, $(SONIC_PACKAGES),\ + $(addsuffix |$($(package)_DEFAULT_FEATURE_STATE_ENABLED),\ + $(addsuffix |$($(package)_DEFAULT_FEATURE_OWNER),\ + $(addsuffix |$($(package)_VERSION),\ + $(addsuffix |$($(package)_REPOSITORY), $(package))))))" + export sonic_local_packages="$(foreach package, $(SONIC_PACKAGES_LOCAL),\ + $(addsuffix |$($(package)_DEFAULT_FEATURE_STATE_ENABLED),\ + $(addsuffix |$($(package)_DEFAULT_FEATURE_OWNER),\ + $(addsuffix |$(addprefix $(TARGET_PATH)/, $(package)), $(package)))))" export sonic_py_common_py2_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_PY_COMMON_PY2))" export sonic_py_common_py3_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_PY_COMMON_PY3))" export config_engine_py2_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_CONFIG_ENGINE_PY2))" From abe88c0de021d74d4b8073f698c742222f0bd2a4 Mon Sep 17 00:00:00 2001 From: Stepan Blyschak Date: Mon, 31 May 2021 06:32:27 +0000 Subject: [PATCH 40/44] bring back dhcp_relay Signed-off-by: Stepan Blyschak --- files/scripts/swss.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/scripts/swss.sh b/files/scripts/swss.sh index 752e52317d7b..730d75bea2c1 100755 --- a/files/scripts/swss.sh +++ b/files/scripts/swss.sh @@ -1,6 +1,6 @@ #!/bin/bash -DEPENDENT="radv" +DEPENDENT="radv dhcp_relay" MULTI_INST_DEPENDENT="teamd" # Update dependent list based on other packages requirements From 9807d93e902480a83b8112e16a3be946721f0fee Mon Sep 17 00:00:00 2001 From: Stepan Blyschak Date: Fri, 11 Jun 2021 17:53:41 +0000 Subject: [PATCH 41/44] introduce _INSTALL_PYTHON_WHEELS and _INSTALL_DEBS to not install sonic-utilities for dockers that dont need it Signed-off-by: Stepan Blyschak --- slave.mk | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/slave.mk b/slave.mk index 6deebe8511b2..aa86571abff7 100644 --- a/slave.mk +++ b/slave.mk @@ -721,10 +721,9 @@ $(addprefix $(TARGET_PATH)/, $(DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .platform $$(addprefix $(PYTHON_DEBS_PATH)/,$$($$*.gz_PYTHON_DEBS)) \ $$(addprefix $(PYTHON_WHEELS_PATH)/,$$($$*.gz_PYTHON_WHEELS)) \ $$(addsuffix -load,$$(addprefix $(TARGET_PATH)/,$$($$*.gz_LOAD_DOCKERS))) \ + $$(addsuffix -install,$$(addprefix $(PYTHON_WHEELS_PATH)/,$$($$*.gz_INSTALL_PYTHON_WHEELS))) \ + $$(addsuffix -install,$$(addprefix $(DEBS_PATH)/,$$($$*.gz_INSTALL_DEBS))) \ $$($$*.gz_PATH)/Dockerfile.j2 \ - $(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_UTILITIES_PY3)-install) \ - $(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_UTILITIES_PY3)-install) \ - $(addprefix $(DEBS_PATH)/,$(PYTHON3_SWSSCOMMON)-install) \ $(call dpkg_depend,$(TARGET_PATH)/%.gz.dep) $(HEADER) From 306feba62ce9417a23c248896220f3df90f9af65 Mon Sep 17 00:00:00 2001 From: Stepan Blyschak Date: Fri, 11 Jun 2021 17:57:36 +0000 Subject: [PATCH 42/44] add install targets for dhcp-relay Signed-off-by: Stepan Blyschak --- rules/docker-dhcp-relay.mk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rules/docker-dhcp-relay.mk b/rules/docker-dhcp-relay.mk index 633d96eafc71..968cc700aaa7 100644 --- a/rules/docker-dhcp-relay.mk +++ b/rules/docker-dhcp-relay.mk @@ -15,6 +15,9 @@ $(DOCKER_DHCP_RELAY)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_I $(DOCKER_DHCP_RELAY)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE_BUSTER) +$(DOCKER_DHCP_RELAY)_INSTALL_PYTHON_WHEELS = $(SONIC_UTILITIES_PY3) +$(DOCKER_DHCP_RELAY)_INSTALL_DEBS = $(PYTHON3_SWSSCOMMON) + $(DOCKER_DHCP_RELAY)_VERSION = 1.0.0 $(DOCKER_DHCP_RELAY)_PACKAGE_NAME = dhcp-relay $(DOCKER_DHCP_RELAY)_PACKAGE_DEPENDS = database^1.0.0 From 42f8b369d87f024be947bc05a04fa6da1736aaed Mon Sep 17 00:00:00 2001 From: Stepan Blyschak Date: Mon, 12 Jul 2021 12:33:22 +0000 Subject: [PATCH 43/44] remove obsolete changes added back by mistake during upstream merge Signed-off-by: Stepan Blyschak --- slave.mk | 3 --- 1 file changed, 3 deletions(-) diff --git a/slave.mk b/slave.mk index 2401fa04516f..6dfec1a535fe 100644 --- a/slave.mk +++ b/slave.mk @@ -726,9 +726,6 @@ $(addprefix $(TARGET_PATH)/, $(DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .platform $$(addsuffix -install,$$(addprefix $(PYTHON_WHEELS_PATH)/,$$($$*.gz_INSTALL_PYTHON_WHEELS))) \ $$(addsuffix -install,$$(addprefix $(DEBS_PATH)/,$$($$*.gz_INSTALL_DEBS))) \ $$($$*.gz_PATH)/Dockerfile.j2 \ - $(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_UTILITIES_PY3)-install) \ - $(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_UTILITIES_PY3)-install) \ - $(addprefix $(DEBS_PATH)/,$(PYTHON3_SWSSCOMMON)-install) \ $(call dpkg_depend,$(TARGET_PATH)/%.gz.dep) $(HEADER) From c86bb450587ba324987ae5130ccb386616a2b755 Mon Sep 17 00:00:00 2001 From: Stepan Blyshchak Date: Wed, 14 Jul 2021 11:01:09 +0300 Subject: [PATCH 44/44] add missing INCLUDE_DHCP_RELAY condition Signed-off-by: Stepan Blyshchak --- rules/docker-dhcp-relay.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rules/docker-dhcp-relay.mk b/rules/docker-dhcp-relay.mk index 968cc700aaa7..a8b33c5bc74c 100644 --- a/rules/docker-dhcp-relay.mk +++ b/rules/docker-dhcp-relay.mk @@ -36,11 +36,13 @@ endif $(DOCKER_DHCP_RELAY)_DEFAULT_FEATURE_STATE_ENABLED = y +ifeq ($(INCLUDE_DHCP_RELAY),y) ifeq ($(INSTALL_DEBUG_TOOLS),y) SONIC_PACKAGES_LOCAL += $(DOCKER_DHCP_RELAY_DBG) else SONIC_PACKAGES_LOCAL += $(DOCKER_DHCP_RELAY) endif +endif $(DOCKER_DHCP_RELAY)_CONTAINER_NAME = dhcp_relay $(DOCKER_DHCP_RELAY)_CONTAINER_PRIVILEGED = true