Add Tag info to docker label meta data (#2058)

* Add Tag info to docker label meta data

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

* Move DIRTY_SUFFIX to sonic_get_version()

Signed-off-by: Jipan Yang <jipan.yang@alibaba-inc.com>
This commit is contained in:
Jipan Yang 2018-09-21 10:44:28 -07:00 committed by lguohan
parent c8a799716c
commit 0e85986088
2 changed files with 4 additions and 3 deletions

View File

@ -51,6 +51,7 @@ docker_try_rmi() {
}
sonic_get_version() {
DIRTY_SUFFIX="$(date +%Y%m%d\.%H%M%S)"
local describe=$(git describe --tags)
local latest_tag=$(git describe --tags --abbrev=0)
local branch_name=$(git rev-parse --abbrev-ref HEAD)

View File

@ -9,6 +9,7 @@ SHELL = /bin/bash
USER = $(shell id -un)
UID = $(shell id -u)
GUID = $(shell id -g)
SONIC_GET_VERSION=$(shell . functions.sh && sonic_get_version)
.SECONDEXPANSION:
@ -393,6 +394,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_SIMPLE_DOCKER_IMAGES)) : $(TARGET_PATH)/%.g
--build-arg uid=$(UID) \
--build-arg guid=$(GUID) \
--build-arg docker_container_name=$($*.gz_CONTAINER_NAME) \
--label Tag=$(SONIC_GET_VERSION) \
-t $* $($*.gz_PATH) $(LOG)
docker save $* | gzip -c > $@
# Clean up
@ -425,6 +427,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .pl
--build-arg uid=$(UID) \
--build-arg guid=$(GUID) \
--build-arg docker_container_name=$($*.gz_CONTAINER_NAME) \
--label Tag=$(SONIC_GET_VERSION) \
-t $* $($*.gz_PATH) $(LOG)
docker save $* | gzip -c > $@
# Clean up
@ -514,9 +517,6 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \
chmod +x sonic_debian_extension.sh,
)
DIRTY_SUFFIX="$(shell date +%Y%m%d\.%H%M%S)"
export DIRTY_SUFFIX
USERNAME="$(USERNAME)" \
PASSWORD="$(PASSWORD)" \
./build_debian.sh $(LOG)