summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoman Gorshunov <roman.gorshunov@att.com>2018-10-24 15:42:58 +0200
committerRoman Gorshunov <roman.gorshunov@att.com>2018-11-08 19:07:51 +0100
commit2c09054c4be0b41f9babb7c95d352d03b05c6bc9 (patch)
tree008ecc5f91df18eaa315c5fdf994a9d822463c4e
parent756a063c3074ddd847af1dd02c9b576b541cedbd (diff)
Fix: adding back the possibility to add arbitrary labels
Arbitrary labels could be added as `make` parameter `LABEL=`, which is used in att-comdev/cicd Jenkins pipelines. Sample parameter: 'LABEL=org.label-schema.vcs-url=${GERRIT_CHANGE_URL} \ --label org.label-schema.base-image=${base_sha256}' Sample usage: See Jenkinsfile files under images/ directory in att-comdev/cicd repo. In addition to that, if `COMMIT` variable is undefined when invoking `make`, we use result of `git rev-parse HEAD` command, which should output latest git commit ID. [0] https://github.com/att-comdev/cicd Change-Id: I9193ca03cb3970e3a3e1cb64ff643a4d24543636
Notes
Notes (review): Code-Review+2: Matt McEuen <matt.mceuen@att.com> Code-Review+2: Scott Hussey <sthussey@att.com> Workflow+1: Scott Hussey <sthussey@att.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Thu, 08 Nov 2018 20:10:03 +0000 Reviewed-on: https://review.openstack.org/613025 Project: openstack/airship-drydock Branch: refs/heads/master
-rw-r--r--Makefile4
-rwxr-xr-xtools/drydock_image_build.sh2
2 files changed, 4 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 3aa9453..9429ab4 100644
--- a/Makefile
+++ b/Makefile
@@ -22,7 +22,9 @@ PROXY ?= http://proxy.foo.com:8000
22NO_PROXY ?= localhost,127.0.0.1,.svc.cluster.local 22NO_PROXY ?= localhost,127.0.0.1,.svc.cluster.local
23USE_PROXY ?= false 23USE_PROXY ?= false
24PUSH_IMAGE ?= false 24PUSH_IMAGE ?= false
25COMMIT ?= commit-id 25# use this variable for image labels added in internal build process
26LABEL ?= org.airshipit.build=community
27COMMIT ?= $(shell git rev-parse HEAD)
26IMAGE ?= ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${IMAGE_NAME}:${IMAGE_TAG} 28IMAGE ?= ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${IMAGE_NAME}:${IMAGE_TAG}
27GO_BUILDER ?= docker.io/golang:1.10-stretch 29GO_BUILDER ?= docker.io/golang:1.10-stretch
28 30
diff --git a/tools/drydock_image_build.sh b/tools/drydock_image_build.sh
index 41c2a4d..e0e585a 100755
--- a/tools/drydock_image_build.sh
+++ b/tools/drydock_image_build.sh
@@ -22,7 +22,7 @@ then
22 ADDL_BUILD_ARGS="${ADDL_BUILD_ARGS}| --build-arg PIP_TRUSTED_HOST=${PIP_TRUSTED_HOST}" 22 ADDL_BUILD_ARGS="${ADDL_BUILD_ARGS}| --build-arg PIP_TRUSTED_HOST=${PIP_TRUSTED_HOST}"
23fi 23fi
24 24
25docker build --network host -t ${IMAGE} \ 25docker build --network host -t ${IMAGE} --label ${LABEL} \
26 --label org.opencontainers.image.revision=${COMMIT} \ 26 --label org.opencontainers.image.revision=${COMMIT} \
27 --label org.opencontainers.image.created="$(date --rfc-3339=seconds --utc)" \ 27 --label org.opencontainers.image.created="$(date --rfc-3339=seconds --utc)" \
28 --label org.opencontainers.image.title=${IMAGE_NAME} \ 28 --label org.opencontainers.image.title=${IMAGE_NAME} \