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:
parent
c8a799716c
commit
0e85986088
@ -51,6 +51,7 @@ docker_try_rmi() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sonic_get_version() {
|
sonic_get_version() {
|
||||||
|
DIRTY_SUFFIX="$(date +%Y%m%d\.%H%M%S)"
|
||||||
local describe=$(git describe --tags)
|
local describe=$(git describe --tags)
|
||||||
local latest_tag=$(git describe --tags --abbrev=0)
|
local latest_tag=$(git describe --tags --abbrev=0)
|
||||||
local branch_name=$(git rev-parse --abbrev-ref HEAD)
|
local branch_name=$(git rev-parse --abbrev-ref HEAD)
|
||||||
|
6
slave.mk
6
slave.mk
@ -9,6 +9,7 @@ SHELL = /bin/bash
|
|||||||
USER = $(shell id -un)
|
USER = $(shell id -un)
|
||||||
UID = $(shell id -u)
|
UID = $(shell id -u)
|
||||||
GUID = $(shell id -g)
|
GUID = $(shell id -g)
|
||||||
|
SONIC_GET_VERSION=$(shell . functions.sh && sonic_get_version)
|
||||||
|
|
||||||
.SECONDEXPANSION:
|
.SECONDEXPANSION:
|
||||||
|
|
||||||
@ -393,6 +394,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_SIMPLE_DOCKER_IMAGES)) : $(TARGET_PATH)/%.g
|
|||||||
--build-arg uid=$(UID) \
|
--build-arg uid=$(UID) \
|
||||||
--build-arg guid=$(GUID) \
|
--build-arg guid=$(GUID) \
|
||||||
--build-arg docker_container_name=$($*.gz_CONTAINER_NAME) \
|
--build-arg docker_container_name=$($*.gz_CONTAINER_NAME) \
|
||||||
|
--label Tag=$(SONIC_GET_VERSION) \
|
||||||
-t $* $($*.gz_PATH) $(LOG)
|
-t $* $($*.gz_PATH) $(LOG)
|
||||||
docker save $* | gzip -c > $@
|
docker save $* | gzip -c > $@
|
||||||
# Clean up
|
# Clean up
|
||||||
@ -425,6 +427,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .pl
|
|||||||
--build-arg uid=$(UID) \
|
--build-arg uid=$(UID) \
|
||||||
--build-arg guid=$(GUID) \
|
--build-arg guid=$(GUID) \
|
||||||
--build-arg docker_container_name=$($*.gz_CONTAINER_NAME) \
|
--build-arg docker_container_name=$($*.gz_CONTAINER_NAME) \
|
||||||
|
--label Tag=$(SONIC_GET_VERSION) \
|
||||||
-t $* $($*.gz_PATH) $(LOG)
|
-t $* $($*.gz_PATH) $(LOG)
|
||||||
docker save $* | gzip -c > $@
|
docker save $* | gzip -c > $@
|
||||||
# Clean up
|
# Clean up
|
||||||
@ -514,9 +517,6 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \
|
|||||||
chmod +x sonic_debian_extension.sh,
|
chmod +x sonic_debian_extension.sh,
|
||||||
)
|
)
|
||||||
|
|
||||||
DIRTY_SUFFIX="$(shell date +%Y%m%d\.%H%M%S)"
|
|
||||||
export DIRTY_SUFFIX
|
|
||||||
|
|
||||||
USERNAME="$(USERNAME)" \
|
USERNAME="$(USERNAME)" \
|
||||||
PASSWORD="$(PASSWORD)" \
|
PASSWORD="$(PASSWORD)" \
|
||||||
./build_debian.sh $(LOG)
|
./build_debian.sh $(LOG)
|
||||||
|
Loading…
Reference in New Issue
Block a user