summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoman Gorshunov <roman.gorshunov@att.com>2018-10-24 15:17:46 +0200
committerRoman Gorshunov <roman.gorshunov@att.com>2018-10-24 18:28:52 +0200
commit24991ffb81464d2869d4249fed4e0addb191604e (patch)
tree23e9fc34d74c22b82619a13863f6b50a7664bab8
parentc3a364c153a3f37c22ff8e56dbdd56323923f5fd (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: Ibd4921de87b2d9cbf094c7f3378a56df470accae
Notes
Notes (review): Code-Review+1: Stacey Fletcher <staceylynnfletcher@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: Mon, 29 Oct 2018 21:38:56 +0000 Reviewed-on: https://review.openstack.org/613015 Project: openstack/airship-maas Branch: refs/heads/master
-rw-r--r--Makefile8
1 files changed, 5 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 949a1ed..14fd1c1 100644
--- a/Makefile
+++ b/Makefile
@@ -26,7 +26,9 @@ PROXY ?= http://proxy.foo.com:8000
26NO_PROXY ?= localhost,127.0.0.1,.svc.cluster.local 26NO_PROXY ?= localhost,127.0.0.1,.svc.cluster.local
27USE_PROXY ?= false 27USE_PROXY ?= false
28PUSH_IMAGE ?= false 28PUSH_IMAGE ?= false
29COMMIT ?= commit-id 29# use this variable for image labels added in internal build process
30LABEL ?= com.internal
31COMMIT ?= $(shell git rev-parse HEAD)
30IMAGE_NAME := maas-rack-controller maas-region-controller sstream-cache 32IMAGE_NAME := maas-rack-controller maas-region-controller sstream-cache
31BUILD_DIR := $(shell mktemp -d) 33BUILD_DIR := $(shell mktemp -d)
32HELM := $(BUILD_DIR)/helm 34HELM := $(BUILD_DIR)/helm
@@ -67,7 +69,7 @@ helm-install:
67.PHONY: build 69.PHONY: build
68build: 70build:
69ifeq ($(USE_PROXY), true) 71ifeq ($(USE_PROXY), true)
70 docker build -t $(IMAGE) --network=host \ 72 docker build -t $(IMAGE) --label $(LABEL) --network=host \
71 --label "org.opencontainers.image.revision=$(COMMIT)" \ 73 --label "org.opencontainers.image.revision=$(COMMIT)" \
72 --label "org.opencontainers.image.created=$(shell date --rfc-3339=seconds --utc)" \ 74 --label "org.opencontainers.image.created=$(shell date --rfc-3339=seconds --utc)" \
73 --label "org.opencontainers.image.title=$(IMAGE_NAME)" \ 75 --label "org.opencontainers.image.title=$(IMAGE_NAME)" \
@@ -82,7 +84,7 @@ ifeq ($(USE_PROXY), true)
82 --build-arg SSTREAM_IMAGE=$(SSTREAM_IMAGE) \ 84 --build-arg SSTREAM_IMAGE=$(SSTREAM_IMAGE) \
83 $(IMAGE_DIR) 85 $(IMAGE_DIR)
84else 86else
85 docker build -t $(IMAGE) --network=host \ 87 docker build -t $(IMAGE) --label $(LABEL) --network=host \
86 --label "org.opencontainers.image.revision=$(COMMIT)" \ 88 --label "org.opencontainers.image.revision=$(COMMIT)" \
87 --label "org.opencontainers.image.created=$(shell date --rfc-3339=seconds --utc)" \ 89 --label "org.opencontainers.image.created=$(shell date --rfc-3339=seconds --utc)" \
88 --label "org.opencontainers.image.title=$(IMAGE_NAME)" \ 90 --label "org.opencontainers.image.title=$(IMAGE_NAME)" \