Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Add Tag info to docker label meta data #2058

Merged
merged 3 commits into from
Sep 21, 2018

Conversation

jipanyang
Copy link
Collaborator

Signed-off-by: Jipan Yang jipan.yang@alibaba-inc.com

- What I did
Add tag info to docker label meta data

- How I did it

- How to verify it
build docker, upgrade to new docker image and check version.

Dirty build

$ docker load < target/docker-orchagent-brcm.gz
dd1eb1fd7e08: Loading layer [==================================================>]  132.7MB/132.7MB
56d22e35f7bb: Loading layer [==================================================>]  121.3MB/121.3MB
3fcd708ea7fd: Loading layer [==================================================>]  52.64MB/52.64MB
fa61ecf1165a: Loading layer [==================================================>]  72.95MB/72.95MB
Loaded image: docker-orchagent-brcm:latest

$ docker inspect --format '{{.ContainerConfig.Labels.Tag}}' docker-orchagent-brcm:latest
warm-reboot.0-dirty-20180918.223356

Clean build

Before upgrade

root@sonic:/home/admin# docker images
REPOSITORY                 TAG                                   IMAGE ID            CREATED             SIZE
docker-orchagent-brcm      latest                                47bb70d653f7        8 days ago          368 MB
docker-orchagent-brcm      test_02                               47bb70d653f7        8 days ago          368 MB
docker-snmp-sv2            latest                                57ad52ea394d        3 weeks ago         373.4 MB
docker-snmp-sv2            warm-reboot.0-dirty-20180823.192608   57ad52ea394d        3 weeks ago         373.4 MB
docker-fpm-quagga          latest                                c68b681610b1        3 weeks ago         380.6 MB
docker-fpm-quagga          warm-reboot.0-dirty-20180823.192608   c68b681610b1        3 weeks ago         380.6 MB
docker-lldp-sv2            latest                                8ecc6ab3e0b7        3 weeks ago         332.4 MB
docker-lldp-sv2            warm-reboot.0-dirty-20180823.192608   8ecc6ab3e0b7        3 weeks ago         332.4 MB
docker-platform-monitor    latest                                e3fea372c435        3 weeks ago         335.7 MB
docker-platform-monitor    warm-reboot.0-dirty-20180823.192608   e3fea372c435        3 weeks ago         335.7 MB
docker-syncd-brcm          latest                                dd8cec44739a        3 weeks ago         410.5 MB
docker-syncd-brcm          warm-reboot.0-dirty-20180823.192608   dd8cec44739a        3 weeks ago         410.5 MB
docker-database            latest                                12f8549a03d0        3 weeks ago         298.5 MB
docker-database            warm-reboot.0-dirty-20180823.192608   12f8549a03d0        3 weeks ago         298.5 MB
docker-sonic-telemetry     latest                                4ee9aeaebcb5        3 weeks ago         324.8 MB
docker-sonic-telemetry     warm-reboot.0-dirty-20180823.192608   4ee9aeaebcb5        3 weeks ago         324.8 MB
docker-dhcp-relay          latest                                1f81836482bf        3 weeks ago         301.6 MB
docker-dhcp-relay          warm-reboot.0-dirty-20180823.192608   1f81836482bf        3 weeks ago         301.6 MB
docker-router-advertiser   latest                                48e9b8ac32b0        3 weeks ago         296.1 MB
docker-router-advertiser   warm-reboot.0-dirty-20180823.192608   48e9b8ac32b0        3 weeks ago         296.1 MB
docker-teamd               latest                                27d6fb7bec52        3 weeks ago         362.3 MB
docker-teamd               warm-reboot.0-dirty-20180823.192608   27d6fb7bec52        3 weeks ago         362.3 MB

upgrade docker

root@sonic:/home/admin# cp /tmp/docker-orchagent-brcm.gz docker-orchagent-brcm_test_01.gz 
root@sonic:/home/admin# sonic_installer upgrade_docker  --enforce_check  --cleanup_image swss ./docker-orchagent-brcm_test_01.gz
New docker image will be installed, continue? [y/N]: y
Orchagent is in clean state and frozen for warm upgrade
Command: systemctl stop swss

Command: docker rm  swss 
swss

Command: docker rmi  docker-orchagent-brcm:latest 
Untagged: docker-orchagent-brcm:latest

Command: docker load < ././docker-orchagent-brcm_test_01.gz

Command: docker tag docker-orchagent-brcm:latest docker-orchagent-brcm:warm-reboot.0-b22b992

Command: systemctl restart swss

Command: docker rmi -f 47bb70d653f7
Untagged: docker-orchagent-brcm:test_02
Deleted: sha256:47bb70d653f7b7d445923aef8dd087270f5c0725825b11470ecdf8d636b2c3e4
Deleted: sha256:59231a939a5c36632d3042276fac03a4fe1c38bc246460c3de8b7651bad152fd

Command: sleep 5

Done

After upgrade

root@sonic:/home/admin# docker images
REPOSITORY                 TAG                                   IMAGE ID            CREATED             SIZE
docker-orchagent-brcm      latest                                e658889ba44a        7 minutes ago       368.2 MB
docker-orchagent-brcm      warm-reboot.0-b22b992                 e658889ba44a        7 minutes ago       368.2 MB
docker-snmp-sv2            latest                                57ad52ea394d        3 weeks ago         373.4 MB
docker-snmp-sv2            warm-reboot.0-dirty-20180823.192608   57ad52ea394d        3 weeks ago         373.4 MB
docker-fpm-quagga          latest                                c68b681610b1        3 weeks ago         380.6 MB
docker-fpm-quagga          warm-reboot.0-dirty-20180823.192608   c68b681610b1        3 weeks ago         380.6 MB
docker-lldp-sv2            latest                                8ecc6ab3e0b7        3 weeks ago         332.4 MB
docker-lldp-sv2            warm-reboot.0-dirty-20180823.192608   8ecc6ab3e0b7        3 weeks ago         332.4 MB
docker-platform-monitor    latest                                e3fea372c435        3 weeks ago         335.7 MB
docker-platform-monitor    warm-reboot.0-dirty-20180823.192608   e3fea372c435        3 weeks ago         335.7 MB
docker-syncd-brcm          latest                                dd8cec44739a        3 weeks ago         410.5 MB
docker-syncd-brcm          warm-reboot.0-dirty-20180823.192608   dd8cec44739a        3 weeks ago         410.5 MB
docker-database            latest                                12f8549a03d0        3 weeks ago         298.5 MB
docker-database            warm-reboot.0-dirty-20180823.192608   12f8549a03d0        3 weeks ago         298.5 MB
docker-sonic-telemetry     latest                                4ee9aeaebcb5        3 weeks ago         324.8 MB
docker-sonic-telemetry     warm-reboot.0-dirty-20180823.192608   4ee9aeaebcb5        3 weeks ago         324.8 MB
docker-dhcp-relay          latest                                1f81836482bf        3 weeks ago         301.6 MB
docker-dhcp-relay          warm-reboot.0-dirty-20180823.192608   1f81836482bf        3 weeks ago         301.6 MB
docker-router-advertiser   latest                                48e9b8ac32b0        3 weeks ago         296.1 MB
docker-router-advertiser   warm-reboot.0-dirty-20180823.192608   48e9b8ac32b0        3 weeks ago         296.1 MB
docker-teamd               latest                                27d6fb7bec52        3 weeks ago         362.3 MB
docker-teamd               warm-reboot.0-dirty-20180823.192608   27d6fb7bec52        3 weeks ago         362.3 MB
root@sonic:/home/admin# 
root@sonic:/home/admin# 

root@sonic:/home/admin# docker inspect --format '{{.ContainerConfig.Labels.Tag}}' docker-orchagent-brcm:latest
warm-reboot.0-b22b992

- A picture of a cute animal (not mandatory but encouraged)

@jipanyang jipanyang changed the title Add Tad info to docker lable meta data Add Tag info to docker lable meta data Sep 18, 2018
Signed-off-by: Jipan Yang <jipan.yang@alibaba-inc.com>
@jipanyang jipanyang changed the title Add Tag info to docker lable meta data Add Tag info to docker label meta data Sep 18, 2018
functions.sh Outdated
@@ -55,7 +55,11 @@ sonic_get_version() {
local latest_tag=$(git describe --tags --abbrev=0)
local branch_name=$(git rev-parse --abbrev-ref HEAD)
if [ -n "$(git status --untracked-files=no -s --ignore-submodules)" ]; then
local dirty="-dirty-$DIRTY_SUFFIX"
if [ -z "$DIRTY_SUFFIX" ]; then
local dirty="-dirty-"$(date +%Y%m%d\.%H%M%S)
Copy link
Collaborator

Choose a reason for hiding this comment

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

DIRTY_SUFFIX is defined in slave.mk, why do we need this check?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I tried changes like moving DIRTY_SUFFIX before SONIC_GET_VERSION

DIRTY_SUFFIX="$(shell date +%Y%m%d\.%H%M%S)"
SONIC_GET_VERSION=$(shell . functions.sh && sonic_get_version)

And even export DIRTY_SUFFIX before docker build. They didn't work, tag like "warm-reboot.0-dirty-" was populated.
I guess there is some evaluation issue with layered macro with shell command in Makefile.

If you have any new idea or different way of handling it, I may give it a try.

Copy link
Collaborator

Choose a reason for hiding this comment

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

does DIRTY_SUFFIX work now?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

DIRTY_SUFFIX works if sonic_get_version() is called from another shell script. But calling it in Makefile is not working. I have not figured out how to do it.

Since DIRTY_SUFFIX is only used in sonic_get_version(), but defined in slave.mk, maybe it should be moved to sonic_get_version() to get rid of the issue introduced with jumping from Makefile to shell and back to Makefile again.

@lguohan lguohan merged commit 0e85986 into sonic-net:master Sep 21, 2018
abdosi added a commit to abdosi/sonic-buildimage that referenced this pull request Jan 13, 2022
c78aa1b (HEAD -> master, origin/master, origin/HEAD) OA changes to support Ordered ECMP and DVS test for same. (sonic-net#2092)
b4b0003 Handling Invalid CRM configuration gracefully (sonic-net#2109)
d240cb2 [Mellanox] '_8lane' not added to Mellanox 5xxx models with 800G (sonic-net#2090)
8fd6e48 [pfcwd] Add vs test infrastructure (sonic-net#2077)
b96ee54 [vnetorch] Advertise vnet tunnel routes (sonic-net#2058)

Signed-off-by: Abhishek Dosi <abdosi@microsoft.com>
abdosi added a commit that referenced this pull request Jan 13, 2022
   [Submodule update] sonic-swss

    c78aa1b (HEAD -> master, origin/master, origin/HEAD) OA changes to support Ordered ECMP and DVS test for same. (#2092)
    b4b0003 Handling Invalid CRM configuration gracefully (#2109)
    d240cb2 [Mellanox] '_8lane' not added to Mellanox 5xxx models with 800G (#2090)
    8fd6e48 [pfcwd] Add vs test infrastructure (#2077)
    b96ee54 [vnetorch] Advertise vnet tunnel routes (#2058)
judyjoseph added a commit that referenced this pull request Jan 17, 2022
a6d35de Handling Invalid CRM configuration gracefully (#2109)
d6559e6 [Mellanox] '_8lane' not added to Mellanox 5xxx models with 800G (#2090)
45551b2 [vnetorch] Advertise vnet tunnel routes (#2058)
ed58d2f Add initial value for weight in overlay nexthops (#2096)
theasianpianist pushed a commit to theasianpianist/sonic-buildimage that referenced this pull request Feb 5, 2022
What I did
Advertise active vnet tunnel routes.

Why I did it
The overlay routes programmed on the device need to be advertised to BGP peers. This PR aims to meet this requirement.

How I verified it
Add an entry in ADVERTISE_NETWORK_TABLE for active overlay routes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants