summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoman Gorshunov <roman.gorshunov@att.com>2018-10-24 15:48:05 +0200
committerRoman Gorshunov <roman.gorshunov@att.com>2018-10-24 18:28:52 +0200
commitef26b1dcc879bb060a23c03bd32faa1df92625e8 (patch)
treecc9ea38bd21717b5ad67a75b1871582d6bbc2c43
parent034c43cf17b7a8b0b826644f3dca76a3e8e879a6 (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: If4e3425ac92f654f1bff046f20535e619a7e595c
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:23:50 +0000 Reviewed-on: https://review.openstack.org/613029 Project: openstack/airship-promenade Branch: refs/heads/master
-rw-r--r--Makefile8
1 files changed, 5 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 93041e8..e47f502 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 ?= com.internal
27COMMIT ?= $(shell git rev-parse HEAD)
26PYTHON = python3 28PYTHON = python3
27CHARTS := $(patsubst charts/%/.,%,$(wildcard charts/*/.)) 29CHARTS := $(patsubst charts/%/.,%,$(wildcard charts/*/.))
28IMAGE := ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${IMAGE_NAME}:${IMAGE_TAG} 30IMAGE := ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${IMAGE_NAME}:${IMAGE_TAG}
@@ -118,7 +120,7 @@ $(CHARTS): $(addprefix dry-run-,$(CHARTS)) chartbanner
118.PHONY: build_promenade 120.PHONY: build_promenade
119build_promenade: 121build_promenade:
120ifeq ($(USE_PROXY), true) 122ifeq ($(USE_PROXY), true)
121 docker build --network host -t $(IMAGE) \ 123 docker build --network host -t $(IMAGE) --label $(LABEL) \
122 --label "org.opencontainers.image.revision=$(COMMIT)" \ 124 --label "org.opencontainers.image.revision=$(COMMIT)" \
123 --label "org.opencontainers.image.created=$(shell date --rfc-3339=seconds --utc)" \ 125 --label "org.opencontainers.image.created=$(shell date --rfc-3339=seconds --utc)" \
124 --label "org.opencontainers.image.title=$(IMAGE_NAME)" \ 126 --label "org.opencontainers.image.title=$(IMAGE_NAME)" \
@@ -131,7 +133,7 @@ ifeq ($(USE_PROXY), true)
131 --build-arg no_proxy=$(NO_PROXY) \ 133 --build-arg no_proxy=$(NO_PROXY) \
132 --build-arg NO_PROXY=$(NO_PROXY) . 134 --build-arg NO_PROXY=$(NO_PROXY) .
133else 135else
134 docker build --network host -t $(IMAGE) \ 136 docker build --network host -t $(IMAGE) --label $(LABEL) \
135 --label "org.opencontainers.image.revision=$(COMMIT)" \ 137 --label "org.opencontainers.image.revision=$(COMMIT)" \
136 --label "org.opencontainers.image.created=$(shell date --rfc-3339=seconds --utc)" \ 138 --label "org.opencontainers.image.created=$(shell date --rfc-3339=seconds --utc)" \
137 --label "org.opencontainers.image.title=$(IMAGE_NAME)" \ 139 --label "org.opencontainers.image.title=$(IMAGE_NAME)" \