From cd2c86eab65a37f9030277bf3f39cbb43a657ef5 Mon Sep 17 00:00:00 2001 From: Stepan Blyshchak <38952541+stepanblyschak@users.noreply.github.com> Date: Mon, 26 Apr 2021 23:51:50 +0300 Subject: [PATCH] [dockers] label SONiC Docker with manifest (#5939) Signed-off-by: Stepan Blyschak stepanb@nvidia.com This PR is part of SONiC Application Extension Depends on #5938 - Why I did it To provide an infrastructure change in order to support SONiC Application Extension feature. - How I did it Label every installable SONiC Docker with a minimal required manifest and auto-generate packages.json file based on installed SONiC images. - How to verify it Build an image, execute the following command: admin@sonic:~$ docker inspect docker-snmp:1.0.0 | jq '.[0].Config.Labels["com.azure.sonic.manifest"]' -r | jq Cat /var/lib/sonic-package-manager/packages.json file to verify all dockers are listed there. --- .gitignore | 5 +++ files/build_templates/manifest.json.j2 | 26 +++++++++++++++ files/build_templates/packages.json.j2 | 17 ++++++++++ .../build_templates/sonic_debian_extension.j2 | 20 +++++++++-- platform/barefoot/docker-syncd-bfn-rpc.mk | 2 ++ platform/barefoot/docker-syncd-bfn.mk | 5 +++ .../barefoot/docker-syncd-bfn/Dockerfile.j2 | 2 ++ platform/broadcom/docker-syncd-brcm-rpc.mk | 2 ++ platform/broadcom/docker-syncd-brcm.mk | 3 ++ .../broadcom/docker-syncd-brcm/Dockerfile.j2 | 1 + platform/cavium/docker-syncd-cavm-rpc.mk | 2 ++ platform/cavium/docker-syncd-cavm.mk | 3 ++ .../cavium/docker-syncd-cavm/Dockerfile.j2 | 1 + .../centec-arm64/docker-syncd-centec-rpc.mk | 2 ++ platform/centec-arm64/docker-syncd-centec.mk | 3 ++ .../docker-syncd-centec/Dockerfile.j2 | 1 + platform/centec/docker-syncd-centec-rpc.mk | 2 ++ platform/centec/docker-syncd-centec.mk | 3 ++ .../centec/docker-syncd-centec/Dockerfile.j2 | 1 + platform/innovium/docker-syncd-invm-rpc.mk | 2 ++ platform/innovium/docker-syncd-invm.mk | 3 ++ .../innovium/docker-syncd-invm/Dockerfile.j2 | 1 + .../marvell-arm64/docker-syncd-mrvl-rpc.mk | 2 ++ platform/marvell-arm64/docker-syncd-mrvl.mk | 3 ++ .../docker-syncd-mrvl/Dockerfile.j2 | 1 + .../marvell-armhf/docker-syncd-mrvl-rpc.mk | 2 ++ platform/marvell-armhf/docker-syncd-mrvl.mk | 3 ++ .../docker-syncd-mrvl/Dockerfile.j2 | 1 + platform/marvell/docker-syncd-mrvl-rpc.mk | 2 ++ platform/marvell/docker-syncd-mrvl.mk | 3 ++ .../marvell/docker-syncd-mrvl/Dockerfile.j2 | 1 + platform/mellanox/docker-syncd-mlnx-rpc.mk | 2 ++ platform/mellanox/docker-syncd-mlnx.mk | 3 ++ .../mellanox/docker-syncd-mlnx/Dockerfile.j2 | 1 + platform/nephos/docker-syncd-nephos-rpc.mk | 2 ++ platform/nephos/docker-syncd-nephos.mk | 5 ++- .../nephos/docker-syncd-nephos/Dockerfile.j2 | 1 + platform/vs/docker-gbsyncd-vs.mk | 3 ++ platform/vs/docker-gbsyncd-vs/Dockerfile.j2 | 1 + platform/vs/docker-syncd-vs.mk | 3 ++ platform/vs/docker-syncd-vs/Dockerfile.j2 | 1 + rules/docker-database.mk | 3 ++ rules/docker-dhcp-relay.mk | 3 ++ rules/docker-fpm-frr.mk | 3 ++ rules/docker-fpm-gobgp.mk | 4 +++ rules/docker-fpm-quagga.mk | 4 +++ rules/docker-iccpd.mk | 3 ++ rules/docker-lldp.mk | 3 ++ rules/docker-macsec.mk | 2 ++ rules/docker-nat.mk | 3 ++ rules/docker-orchagent.mk | 3 ++ rules/docker-platform-monitor.mk | 3 ++ rules/docker-restapi.mk | 3 ++ rules/docker-router-advertiser.mk | 3 ++ rules/docker-sflow.mk | 3 ++ rules/docker-snmp.mk | 3 ++ rules/docker-sonic-mgmt-framework.mk | 4 +++ rules/docker-teamd.mk | 3 ++ rules/docker-telemetry.mk | 4 +++ rules/functions | 33 +++++++++++++++++++ scripts/j2cli/json_filter.py | 12 +++++++ slave.mk | 9 ++++- sonic-slave-buster/Dockerfile.j2 | 1 + sonic-slave-jessie/Dockerfile.j2 | 1 + sonic-slave-stretch/Dockerfile.j2 | 1 + 65 files changed, 256 insertions(+), 5 deletions(-) create mode 100644 files/build_templates/manifest.json.j2 create mode 100644 files/build_templates/packages.json.j2 create mode 100644 scripts/j2cli/json_filter.py diff --git a/.gitignore b/.gitignore index 5e76a6cf92..d608aea9fa 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* +platform/*/docker-*/*manifest* + # Installer-related files and directories installer/x86_64/platforms/ diff --git a/files/build_templates/manifest.json.j2 b/files/build_templates/manifest.json.j2 new file mode 100644 index 0000000000..5b09e1d987 --- /dev/null +++ b/files/build_templates/manifest.json.j2 @@ -0,0 +1,26 @@ +{ + "version": "1.0.0", + "package": { + "version": "{{ version }}", + "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/files/build_templates/packages.json.j2 b/files/build_templates/packages.json.j2 new file mode 100644 index 0000000000..3c0d103403 --- /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 59d56d5b51..274019215b 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -618,11 +618,21 @@ 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(' ') -%} -{% set imagefilename = image.split('/')|last -%} + +{% 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 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 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 > /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 +} {% 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}" @@ -630,6 +640,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 + # Copy docker_image_ctl.j2 for SONiC Package Manager sudo cp $BUILD_TEMPLATES/docker_image_ctl.j2 $FILESYSTEM_ROOT_USR_SHARE_SONIC_TEMPLATES/docker_image_ctl.j2 diff --git a/platform/barefoot/docker-syncd-bfn-rpc.mk b/platform/barefoot/docker-syncd-bfn-rpc.mk index aee465151d..451289d727 100644 --- a/platform/barefoot/docker-syncd-bfn-rpc.mk +++ b/platform/barefoot/docker-syncd-bfn-rpc.mk @@ -17,6 +17,8 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_BFN_RPC) endif $(DOCKER_SYNCD_BFN_RPC)_CONTAINER_NAME = syncd +$(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 $(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 3a5c693e2f..6c665abbfe 100644 --- a/platform/barefoot/docker-syncd-bfn.mk +++ b/platform/barefoot/docker-syncd-bfn.mk @@ -10,5 +10,10 @@ $(DOCKER_SYNCD_BASE)_DBG_DEPENDS += $(SYNCD_DBG) \ $(LIBSAIMETADATA_DBG) \ $(LIBSAIREDIS_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/barefoot/docker-syncd-bfn/Dockerfile.j2 b/platform/barefoot/docker-syncd-bfn/Dockerfile.j2 index b9dbad9636..7071b0c8b5 100755 --- a/platform/barefoot/docker-syncd-bfn/Dockerfile.j2 +++ b/platform/barefoot/docker-syncd-bfn/Dockerfile.j2 @@ -1,5 +1,7 @@ FROM docker-config-engine-buster +ARG docker_container_name + ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive diff --git a/platform/broadcom/docker-syncd-brcm-rpc.mk b/platform/broadcom/docker-syncd-brcm-rpc.mk index 27a041d950..7ee58dda45 100644 --- a/platform/broadcom/docker-syncd-brcm-rpc.mk +++ b/platform/broadcom/docker-syncd-brcm-rpc.mk @@ -17,6 +17,8 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_BRCM_RPC) endif $(DOCKER_SYNCD_BRCM_RPC)_CONTAINER_NAME = syncd +$(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 $(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 d231414819..72210c0c72 100644 --- a/platform/broadcom/docker-syncd-brcm.mk +++ b/platform/broadcom/docker-syncd-brcm.mk @@ -11,6 +11,9 @@ $(DOCKER_SYNCD_BASE)_DBG_DEPENDS += $(SYNCD_DBG) \ $(LIBSAIMETADATA_DBG) \ $(LIBSAIREDIS_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 += bcmcmd:/usr/bin/bcmcmd diff --git a/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 b/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 index 0ba71bb5d7..a70e91bb60 100755 --- a/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 +++ b/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 @@ -2,6 +2,7 @@ FROM docker-config-engine-buster ARG docker_container_name + 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/cavium/docker-syncd-cavm-rpc.mk b/platform/cavium/docker-syncd-cavm-rpc.mk index a19124609b..8dfd294b0f 100644 --- a/platform/cavium/docker-syncd-cavm-rpc.mk +++ b/platform/cavium/docker-syncd-cavm-rpc.mk @@ -17,6 +17,8 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_CAVM_RPC) endif $(DOCKER_SYNCD_CAVM_RPC)_CONTAINER_NAME = syncd +$(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 $(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 059d2c71eb..18db076866 100644 --- a/platform/cavium/docker-syncd-cavm.mk +++ b/platform/cavium/docker-syncd-cavm.mk @@ -16,6 +16,9 @@ ifneq ($(ENABLE_SYNCD_RPC),y) 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 $(DOCKER_SYNCD_CAVM)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf diff --git a/platform/cavium/docker-syncd-cavm/Dockerfile.j2 b/platform/cavium/docker-syncd-cavm/Dockerfile.j2 index fcf82276ad..8ac883e629 100755 --- a/platform/cavium/docker-syncd-cavm/Dockerfile.j2 +++ b/platform/cavium/docker-syncd-cavm/Dockerfile.j2 @@ -1,6 +1,7 @@ FROM docker-config-engine ARG docker_container_name + 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/centec-arm64/docker-syncd-centec-rpc.mk b/platform/centec-arm64/docker-syncd-centec-rpc.mk index 2c441e4fc4..7b6be9cdb3 100755 --- a/platform/centec-arm64/docker-syncd-centec-rpc.mk +++ b/platform/centec-arm64/docker-syncd-centec-rpc.mk @@ -17,6 +17,8 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_CENTEC_RPC) endif $(DOCKER_SYNCD_CENTEC_RPC)_CONTAINER_NAME = syncd +$(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 $(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 9c3d1b1aff..e53a1d4308 100755 --- a/platform/centec-arm64/docker-syncd-centec.mk +++ b/platform/centec-arm64/docker-syncd-centec.mk @@ -10,6 +10,9 @@ $(DOCKER_SYNCD_BASE)_DBG_DEPENDS += $(SYNCD_DBG) \ $(LIBSAIMETADATA_DBG) \ $(LIBSAIREDIS_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 b97bfe3d3e..7f89c0c986 100755 --- a/platform/centec-arm64/docker-syncd-centec/Dockerfile.j2 +++ b/platform/centec-arm64/docker-syncd-centec/Dockerfile.j2 @@ -1,6 +1,7 @@ FROM docker-config-engine-buster ARG docker_container_name + 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/centec/docker-syncd-centec-rpc.mk b/platform/centec/docker-syncd-centec-rpc.mk index 6b912185b7..88c101182b 100644 --- a/platform/centec/docker-syncd-centec-rpc.mk +++ b/platform/centec/docker-syncd-centec-rpc.mk @@ -17,6 +17,8 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_CENTEC_RPC) endif $(DOCKER_SYNCD_CENTEC_RPC)_CONTAINER_NAME = syncd +$(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 $(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 75cc45c285..65ac38d59f 100644 --- a/platform/centec/docker-syncd-centec.mk +++ b/platform/centec/docker-syncd-centec.mk @@ -10,6 +10,9 @@ $(DOCKER_SYNCD_CENTEC)_DEPENDS += $(SYNCD_DBG) \ $(LIBSAIMETADATA_DBG) \ $(LIBSAIREDIS_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 $(DOCKER_SYNCD_CENTEC)_RUN_OPT += -v /var/run/docker-syncd:/var/run/sswsyncd diff --git a/platform/centec/docker-syncd-centec/Dockerfile.j2 b/platform/centec/docker-syncd-centec/Dockerfile.j2 index ce3b47bcdd..001e944bb8 100755 --- a/platform/centec/docker-syncd-centec/Dockerfile.j2 +++ b/platform/centec/docker-syncd-centec/Dockerfile.j2 @@ -1,6 +1,7 @@ FROM docker-config-engine-buster ARG docker_container_name + 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/innovium/docker-syncd-invm-rpc.mk b/platform/innovium/docker-syncd-invm-rpc.mk index 62d6891bbc..e56570d705 100755 --- a/platform/innovium/docker-syncd-invm-rpc.mk +++ b/platform/innovium/docker-syncd-invm-rpc.mk @@ -10,6 +10,8 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_INVM_RPC) endif $(DOCKER_SYNCD_INVM_RPC)_CONTAINER_NAME = syncd +$(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 $(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 52c11b9091..f500515c56 100755 --- a/platform/innovium/docker-syncd-invm.mk +++ b/platform/innovium/docker-syncd-invm.mk @@ -13,4 +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)_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 ab4be823de..4bdc7a6ebe 100755 --- a/platform/innovium/docker-syncd-invm/Dockerfile.j2 +++ b/platform/innovium/docker-syncd-invm/Dockerfile.j2 @@ -1,6 +1,7 @@ FROM docker-config-engine-stretch ARG docker_container_name + 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/marvell-arm64/docker-syncd-mrvl-rpc.mk b/platform/marvell-arm64/docker-syncd-mrvl-rpc.mk index c3ce6c1011..414bc500b4 100644 --- a/platform/marvell-arm64/docker-syncd-mrvl-rpc.mk +++ b/platform/marvell-arm64/docker-syncd-mrvl-rpc.mk @@ -18,6 +18,8 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_MRVL_RPC) endif $(DOCKER_SYNCD_MRVL_RPC)_CONTAINER_NAME = syncd +$(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 $(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 dd01caab68..f35ce7fa36 100644 --- a/platform/marvell-arm64/docker-syncd-mrvl.mk +++ b/platform/marvell-arm64/docker-syncd-mrvl.mk @@ -13,5 +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)_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 afaac3fd05..6f96738e0d 100755 --- a/platform/marvell-arm64/docker-syncd-mrvl/Dockerfile.j2 +++ b/platform/marvell-arm64/docker-syncd-mrvl/Dockerfile.j2 @@ -1,6 +1,7 @@ FROM docker-config-engine-stretch ARG docker_container_name + 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/marvell-armhf/docker-syncd-mrvl-rpc.mk b/platform/marvell-armhf/docker-syncd-mrvl-rpc.mk index 72c6d8722d..30958019c1 100644 --- a/platform/marvell-armhf/docker-syncd-mrvl-rpc.mk +++ b/platform/marvell-armhf/docker-syncd-mrvl-rpc.mk @@ -17,6 +17,8 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_MRVL_RPC) endif $(DOCKER_SYNCD_MRVL_RPC)_CONTAINER_NAME = syncd +$(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 $(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 699bd8bd9b..65f6069750 100644 --- a/platform/marvell-armhf/docker-syncd-mrvl.mk +++ b/platform/marvell-armhf/docker-syncd-mrvl.mk @@ -10,5 +10,8 @@ $(DOCKER_SYNCD_BASE)_DBG_DEPENDS += $(SYNCD_DBG) \ $(LIBSAIMETADATA_DBG) \ $(LIBSAIREDIS_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 aba1cedd79..b13346cd70 100755 --- a/platform/marvell-armhf/docker-syncd-mrvl/Dockerfile.j2 +++ b/platform/marvell-armhf/docker-syncd-mrvl/Dockerfile.j2 @@ -2,6 +2,7 @@ FROM docker-config-engine-buster ARG docker_container_name + 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/marvell/docker-syncd-mrvl-rpc.mk b/platform/marvell/docker-syncd-mrvl-rpc.mk index c3ce6c1011..414bc500b4 100644 --- a/platform/marvell/docker-syncd-mrvl-rpc.mk +++ b/platform/marvell/docker-syncd-mrvl-rpc.mk @@ -18,6 +18,8 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_MRVL_RPC) endif $(DOCKER_SYNCD_MRVL_RPC)_CONTAINER_NAME = syncd +$(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 $(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 d6d7d032b8..d7617aac18 100644 --- a/platform/marvell/docker-syncd-mrvl.mk +++ b/platform/marvell/docker-syncd-mrvl.mk @@ -13,6 +13,9 @@ $(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)_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 $(DOCKER_SYNCD_BASE)_BASE_IMAGE_FILES += monit_syncd:/etc/monit/conf.d diff --git a/platform/marvell/docker-syncd-mrvl/Dockerfile.j2 b/platform/marvell/docker-syncd-mrvl/Dockerfile.j2 index e91231e497..be69f83172 100755 --- a/platform/marvell/docker-syncd-mrvl/Dockerfile.j2 +++ b/platform/marvell/docker-syncd-mrvl/Dockerfile.j2 @@ -1,6 +1,7 @@ FROM docker-config-engine-stretch ARG docker_container_name + 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/mellanox/docker-syncd-mlnx-rpc.mk b/platform/mellanox/docker-syncd-mlnx-rpc.mk index 806b40035f..fe2ff59164 100644 --- a/platform/mellanox/docker-syncd-mlnx-rpc.mk +++ b/platform/mellanox/docker-syncd-mlnx-rpc.mk @@ -20,6 +20,8 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_MLNX_RPC) endif $(DOCKER_SYNCD_MLNX_RPC)_CONTAINER_NAME = syncd +$(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 $(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 9bdc5a8ad8..6e6a17c777 100644 --- a/platform/mellanox/docker-syncd-mlnx.mk +++ b/platform/mellanox/docker-syncd-mlnx.mk @@ -14,5 +14,8 @@ 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)_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 c862106c2b..011931b2ff 100755 --- a/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 +++ b/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 @@ -2,6 +2,7 @@ FROM docker-config-engine-buster ARG docker_container_name + RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf RUN mkdir -p /var/run/sx_sdk diff --git a/platform/nephos/docker-syncd-nephos-rpc.mk b/platform/nephos/docker-syncd-nephos-rpc.mk index 39240c1913..ea514712c5 100644 --- a/platform/nephos/docker-syncd-nephos-rpc.mk +++ b/platform/nephos/docker-syncd-nephos-rpc.mk @@ -18,6 +18,8 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_NEPHOS_RPC) endif $(DOCKER_SYNCD_NEPHOS_RPC)_CONTAINER_NAME = syncd +$(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 $(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 146523ec1c..7076a3803c 100644 --- a/platform/nephos/docker-syncd-nephos.mk +++ b/platform/nephos/docker-syncd-nephos.mk @@ -10,10 +10,13 @@ $(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)_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 e142fa04d5..3c7ffa1e49 100755 --- a/platform/nephos/docker-syncd-nephos/Dockerfile.j2 +++ b/platform/nephos/docker-syncd-nephos/Dockerfile.j2 @@ -1,6 +1,7 @@ FROM docker-config-engine-stretch ARG docker_container_name + 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/vs/docker-gbsyncd-vs.mk b/platform/vs/docker-gbsyncd-vs.mk index 2013132d62..50bb8e86b4 100644 --- a/platform/vs/docker-gbsyncd-vs.mk +++ b/platform/vs/docker-gbsyncd-vs.mk @@ -11,4 +11,7 @@ $(DOCKER_GBSYNCD_BASE)_DBG_DEPENDS += $(SYNCD_VS_DBG) \ $(LIBSAIREDIS_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 ae7e1c99b7..a9e7f6f53d 100644 --- a/platform/vs/docker-gbsyncd-vs/Dockerfile.j2 +++ b/platform/vs/docker-gbsyncd-vs/Dockerfile.j2 @@ -1,6 +1,7 @@ FROM docker-config-engine-buster ARG docker_container_name + 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/vs/docker-syncd-vs.mk b/platform/vs/docker-syncd-vs.mk index 15d94c5854..d2f7872ea4 100644 --- a/platform/vs/docker-syncd-vs.mk +++ b/platform/vs/docker-syncd-vs.mk @@ -11,4 +11,7 @@ $(DOCKER_SYNCD_BASE)_DBG_DEPENDS += $(SYNCD_VS_DBG) \ $(LIBSAIREDIS_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 b3d7dcef49..7fc6391f36 100644 --- a/platform/vs/docker-syncd-vs/Dockerfile.j2 +++ b/platform/vs/docker-syncd-vs/Dockerfile.j2 @@ -1,6 +1,7 @@ FROM docker-config-engine-buster ARG docker_container_name + RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf ## Make apt-get non-interactive diff --git a/rules/docker-database.mk b/rules/docker-database.mk index 0a2f46d192..1f90378802 100644 --- a/rules/docker-database.mk +++ b/rules/docker-database.mk @@ -12,6 +12,9 @@ $(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 6be9bb79fd..a4cb3573e4 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)_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 e584bf5510..601671da3b 100644 --- a/rules/docker-fpm-frr.mk +++ b/rules/docker-fpm-frr.mk @@ -16,6 +16,9 @@ $(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) SONIC_DOCKER_DBG_IMAGES += $(DOCKER_FPM_FRR_DBG) diff --git a/rules/docker-fpm-gobgp.mk b/rules/docker-fpm-gobgp.mk index 03ec88e85b..a773651ae1 100644 --- a/rules/docker-fpm-gobgp.mk +++ b/rules/docker-fpm-gobgp.mk @@ -4,6 +4,10 @@ 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 +$(DOCKER_FPM_GOBGP)_PACKAGE_NAME = fpm-gobgp + 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 ba3d8a428b..2d11ed7947 100644 --- a/rules/docker-fpm-quagga.mk +++ b/rules/docker-fpm-quagga.mk @@ -4,6 +4,10 @@ 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 +$(DOCKER_FPM_QUAGGA)_PACKAGE_NAME = fpm-quagga + 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 da77d9c9c1..69b9fee50e 100644 --- a/rules/docker-iccpd.mk +++ b/rules/docker-iccpd.mk @@ -10,6 +10,9 @@ $(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 +$(DOCKER_ICCPD)_ICCPD = iccpd + 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 5cd4fd02a0..08e765ecdd 100644 --- a/rules/docker-lldp.mk +++ b/rules/docker-lldp.mk @@ -16,6 +16,9 @@ $(DOCKER_LLDP)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_IMAGE_P $(DOCKER_LLDP)_PYTHON_WHEELS += $(DBSYNCD_PY3) $(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-macsec.mk b/rules/docker-macsec.mk index e112a8fd3d..8fc5e0baa8 100644 --- a/rules/docker-macsec.mk +++ b/rules/docker-macsec.mk @@ -26,6 +26,8 @@ SONIC_INSTALL_DOCKER_DBG_IMAGES += $(DOCKER_MACSEC_DBG) endif $(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 diff --git a/rules/docker-nat.mk b/rules/docker-nat.mk index 981019dbcd..6c958bb8ec 100644 --- a/rules/docker-nat.mk +++ b/rules/docker-nat.mk @@ -13,6 +13,9 @@ $(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) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_NAT) diff --git a/rules/docker-orchagent.mk b/rules/docker-orchagent.mk index 5e2e08ee24..ff54642d8f 100644 --- a/rules/docker-orchagent.mk +++ b/rules/docker-orchagent.mk @@ -17,6 +17,9 @@ $(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 5a930a8134..365b474ed9 100644 --- a/rules/docker-platform-monitor.mk +++ b/rules/docker-platform-monitor.mk @@ -44,6 +44,9 @@ $(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 917a270266..1df80f26d9 100644 --- a/rules/docker-restapi.mk +++ b/rules/docker-restapi.mk @@ -10,6 +10,9 @@ $(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) SONIC_STRETCH_DOCKERS += $(DOCKER_RESTAPI) diff --git a/rules/docker-router-advertiser.mk b/rules/docker-router-advertiser.mk index 38bd959056..083c83dbb6 100644 --- a/rules/docker-router-advertiser.mk +++ b/rules/docker-router-advertiser.mk @@ -13,6 +13,9 @@ $(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 6888304b8b..959afed883 100644 --- a/rules/docker-sflow.mk +++ b/rules/docker-sflow.mk @@ -13,6 +13,9 @@ $(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) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SFLOW) diff --git a/rules/docker-snmp.mk b/rules/docker-snmp.mk index cbc69dc92b..cf6d14c40b 100644 --- a/rules/docker-snmp.mk +++ b/rules/docker-snmp.mk @@ -17,6 +17,9 @@ $(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 +$(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 65bac8bd9d..ef1d559908 100644 --- a/rules/docker-sonic-mgmt-framework.mk +++ b/rules/docker-sonic-mgmt-framework.mk @@ -13,6 +13,10 @@ $(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)_PACKAGE_NAME = mgmt-framework + $(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 5442d5bf6b..088860fb5d 100644 --- a/rules/docker-teamd.mk +++ b/rules/docker-teamd.mk @@ -15,6 +15,9 @@ $(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 5152a38696..4a1dd9e67d 100644 --- a/rules/docker-telemetry.mk +++ b/rules/docker-telemetry.mk @@ -11,6 +11,10 @@ $(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)_PACKAGE_NAME = telemetry + $(DOCKER_TELEMETRY)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_IMAGE_PACKAGES) SONIC_DOCKER_IMAGES += $(DOCKER_TELEMETRY) diff --git a/rules/functions b/rules/functions index c6caebe828..479f5f70c4 100644 --- a/rules/functions +++ b/rules/functions @@ -166,3 +166,36 @@ 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 +## TODO: changelog generation +############################################################################### +# 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)) + $(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/scripts/j2cli/json_filter.py b/scripts/j2cli/json_filter.py new file mode 100644 index 0000000000..62b35ab22d --- /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 8b06a0967d..9cce5392cc 100644 --- a/slave.mk +++ b/slave.mk @@ -748,6 +748,7 @@ $(addprefix $(TARGET_PATH)/, $(DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .platform $(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]++')) j2 $($*.gz_PATH)/Dockerfile.j2 > $($*.gz_PATH)/Dockerfile + $(call generate_manifest,$*) # Prepare docker build info PACKAGE_URL_PREFIX=$(PACKAGE_URL_PREFIX) \ SONIC_ENFORCE_VERSIONS=$(SONIC_ENFORCE_VERSIONS) \ @@ -765,6 +766,7 @@ $(addprefix $(TARGET_PATH)/, $(DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .platform --build-arg frr_user_uid=$(FRR_USER_UID) \ --build-arg frr_user_gid=$(FRR_USER_GID) \ --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) @@ -801,6 +803,7 @@ $(addprefix $(TARGET_PATH)/, $(DOCKER_DBG_IMAGES)) : $(TARGET_PATH)/%-$(DBG_IMAG $(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_dbg_pkgs=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_DBG_APT_PACKAGES),RDEPENDS))\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) \ @@ -813,6 +816,7 @@ $(addprefix $(TARGET_PATH)/, $(DOCKER_DBG_IMAGES)) : $(TARGET_PATH)/%-$(DBG_IMAG --build-arg http_proxy=$(HTTP_PROXY) \ --build-arg no_proxy=$(NO_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) @@ -917,7 +921,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="$(addprefix $(TARGET_PATH)/,$($*_DOCKERS))" + 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))" diff --git a/sonic-slave-buster/Dockerfile.j2 b/sonic-slave-buster/Dockerfile.j2 index 7a1735b0b3..90fb772df4 100644 --- a/sonic-slave-buster/Dockerfile.j2 +++ b/sonic-slave-buster/Dockerfile.j2 @@ -77,6 +77,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 f103dfb789..17e6827d19 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 eae1e7e658..fcd4182f0a 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 \