summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoman Gorshunov <roman.gorshunov@att.com>2018-10-24 16:01:18 +0200
committerRoman Gorshunov <roman.gorshunov@att.com>2018-10-24 18:28:52 +0200
commite2edd5fef9927f87a606bee2fac39188c3b7ebe6 (patch)
treeeb8463734dad1792905e59e719e18949d3eff3e5
parentb4cd48cde0225417da8ab149539ee87b1571ee1c (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: I795d1443f60f362c5ecb244cb90ee8052603854f
Notes
Notes (review): Code-Review+1: Stacey Fletcher <staceylynnfletcher@gmail.com> Code-Review+1: Drew Walters <drewwalters96@gmail.com> Code-Review+2: Felipe Monteiro <felipe.monteiro@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: Wed, 24 Oct 2018 21:50:07 +0000 Reviewed-on: https://review.openstack.org/613035 Project: openstack/airship-deckhand Branch: refs/heads/master
-rw-r--r--Makefile8
1 files changed, 5 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 3e40168..1bcda62 100644
--- a/Makefile
+++ b/Makefile
@@ -21,7 +21,9 @@ PROXY ?= http://proxy.foo.com:8000
21NO_PROXY ?= localhost,127.0.0.1,.svc.cluster.local 21NO_PROXY ?= localhost,127.0.0.1,.svc.cluster.local
22USE_PROXY ?= false 22USE_PROXY ?= false
23PUSH_IMAGE ?= false 23PUSH_IMAGE ?= false
24COMMIT ?= commit-id 24# use this variable for image labels added in internal build process
25LABEL ?= com.internal
26COMMIT ?= $(shell git rev-parse HEAD)
25IMAGE := ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${IMAGE_NAME}:${IMAGE_TAG} 27IMAGE := ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${IMAGE_NAME}:${IMAGE_TAG}
26 28
27# Build Deckhand Docker image for this project 29# Build Deckhand Docker image for this project
@@ -52,7 +54,7 @@ tests:
52.PHONY: build_deckhand 54.PHONY: build_deckhand
53build_deckhand: 55build_deckhand:
54ifeq ($(USE_PROXY), true) 56ifeq ($(USE_PROXY), true)
55 docker build --network host -t $(IMAGE) \ 57 docker build --network host -t $(IMAGE) --label $(LABEL) \
56 --label "org.opencontainers.image.revision=$(COMMIT)" \ 58 --label "org.opencontainers.image.revision=$(COMMIT)" \
57 --label "org.opencontainers.image.created=$(shell date --rfc-3339=seconds --utc)" \ 59 --label "org.opencontainers.image.created=$(shell date --rfc-3339=seconds --utc)" \
58 --label "org.opencontainers.image.title=$(IMAGE_NAME)" \ 60 --label "org.opencontainers.image.title=$(IMAGE_NAME)" \
@@ -64,7 +66,7 @@ ifeq ($(USE_PROXY), true)
64 --build-arg no_proxy=$(NO_PROXY) \ 66 --build-arg no_proxy=$(NO_PROXY) \
65 --build-arg NO_PROXY=$(NO_PROXY) . 67 --build-arg NO_PROXY=$(NO_PROXY) .
66else 68else
67 docker build --network host -t $(IMAGE) \ 69 docker build --network host -t $(IMAGE) --label $(LABEL) \
68 --label "org.opencontainers.image.revision=$(COMMIT)" \ 70 --label "org.opencontainers.image.revision=$(COMMIT)" \
69 --label "org.opencontainers.image.created=$(shell date --rfc-3339=seconds --utc)" \ 71 --label "org.opencontainers.image.created=$(shell date --rfc-3339=seconds --utc)" \
70 --label "org.opencontainers.image.title=$(IMAGE_NAME)" \ 72 --label "org.opencontainers.image.title=$(IMAGE_NAME)" \