summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoman Gorshunov <roman.gorshunov@att.com>2018-10-24 15:57:39 +0200
committerRoman Gorshunov <roman.gorshunov@att.com>2018-10-24 18:28:52 +0200
commit1863d36c62d00a0cfddc3859da26a807bd161059 (patch)
tree3626020db6cbc36eb2e3a0adb7fb6fd03e6c7f1a
parent1c8fd5ce4f793aaf12a97eb4684a6d5a8a5d7661 (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: I7c6b63c865ac0ff63f4a85ec54863c20781fe98d
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:36:21 +0000 Reviewed-on: https://review.openstack.org/613033 Project: openstack/airship-shipyard Branch: refs/heads/master
-rw-r--r--Makefile12
1 files changed, 7 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index 7428581..de2ba7e 100644
--- a/Makefile
+++ b/Makefile
@@ -18,7 +18,9 @@ BUILD_CTX ?= src/bin
18IMAGE_PREFIX ?= airshipit 18IMAGE_PREFIX ?= airshipit
19IMAGE_TAG ?= untagged 19IMAGE_TAG ?= untagged
20IMAGE_NAME := airflow shipyard 20IMAGE_NAME := airflow shipyard
21COMMIT ?= commit-id 21# use this variable for image labels added in internal build process
22LABEL ?= com.internal
23COMMIT ?= $(shell git rev-parse HEAD)
22 24
23DOCKER_REGISTRY ?= quay.io 25DOCKER_REGISTRY ?= quay.io
24PUSH_IMAGE ?= false 26PUSH_IMAGE ?= false
@@ -83,7 +85,7 @@ run:
83.PHONY: build_airflow 85.PHONY: build_airflow
84build_airflow: 86build_airflow:
85ifeq ($(USE_PROXY), true) 87ifeq ($(USE_PROXY), true)
86 docker build --network host -t $(IMAGE) \ 88 docker build --network host -t $(IMAGE) --label $(LABEL) \
87 --label "org.opencontainers.image.revision=$(COMMIT)" \ 89 --label "org.opencontainers.image.revision=$(COMMIT)" \
88 --label "org.opencontainers.image.created=$(shell date --rfc-3339=seconds --utc)" \ 90 --label "org.opencontainers.image.created=$(shell date --rfc-3339=seconds --utc)" \
89 --label "org.opencontainers.image.title=$(IMAGE_NAME)" \ 91 --label "org.opencontainers.image.title=$(IMAGE_NAME)" \
@@ -97,7 +99,7 @@ ifeq ($(USE_PROXY), true)
97 --build-arg NO_PROXY=$(NO_PROXY) \ 99 --build-arg NO_PROXY=$(NO_PROXY) \
98 --build-arg ctx_base=$(BUILD_CTX) . 100 --build-arg ctx_base=$(BUILD_CTX) .
99else 101else
100 docker build --network host -t $(IMAGE) \ 102 docker build --network host -t $(IMAGE) --label $(LABEL) \
101 --label "org.opencontainers.image.revision=$(COMMIT)" \ 103 --label "org.opencontainers.image.revision=$(COMMIT)" \
102 --label "org.opencontainers.image.created=$(shell date --rfc-3339=seconds --utc)" \ 104 --label "org.opencontainers.image.created=$(shell date --rfc-3339=seconds --utc)" \
103 --label "org.opencontainers.image.title=$(IMAGE_NAME)" \ 105 --label "org.opencontainers.image.title=$(IMAGE_NAME)" \
@@ -112,7 +114,7 @@ endif
112.PHONY: build_shipyard 114.PHONY: build_shipyard
113build_shipyard: 115build_shipyard:
114ifeq ($(USE_PROXY), true) 116ifeq ($(USE_PROXY), true)
115 docker build --network host -t $(IMAGE) \ 117 docker build --network host -t $(IMAGE) --label $(LABEL) \
116 --label "org.opencontainers.image.revision=$(COMMIT)" \ 118 --label "org.opencontainers.image.revision=$(COMMIT)" \
117 --label "org.opencontainers.image.created=$(shell date --rfc-3339=seconds --utc)" \ 119 --label "org.opencontainers.image.created=$(shell date --rfc-3339=seconds --utc)" \
118 --label "org.opencontainers.image.title=$(IMAGE_NAME)" \ 120 --label "org.opencontainers.image.title=$(IMAGE_NAME)" \
@@ -126,7 +128,7 @@ ifeq ($(USE_PROXY), true)
126 --build-arg NO_PROXY=$(NO_PROXY) \ 128 --build-arg NO_PROXY=$(NO_PROXY) \
127 --build-arg ctx_base=$(BUILD_CTX) . 129 --build-arg ctx_base=$(BUILD_CTX) .
128else 130else
129 docker build --network host -t $(IMAGE) \ 131 docker build --network host -t $(IMAGE) --label $(LABEL) \
130 --label "org.opencontainers.image.revision=$(COMMIT)" \ 132 --label "org.opencontainers.image.revision=$(COMMIT)" \
131 --label "org.opencontainers.image.created=$(shell date --rfc-3339=seconds --utc)" \ 133 --label "org.opencontainers.image.created=$(shell date --rfc-3339=seconds --utc)" \
132 --label "org.opencontainers.image.title=$(IMAGE_NAME)" \ 134 --label "org.opencontainers.image.title=$(IMAGE_NAME)" \