diff options
author | Roman Gorshunov <roman.gorshunov@att.com> | 2018-10-24 15:17:46 +0200 |
---|---|---|
committer | Roman Gorshunov <roman.gorshunov@att.com> | 2018-10-24 18:28:52 +0200 |
commit | 24991ffb81464d2869d4249fed4e0addb191604e (patch) | |
tree | 23e9fc34d74c22b82619a13863f6b50a7664bab8 | |
parent | c3a364c153a3f37c22ff8e56dbdd56323923f5fd (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-- | Makefile | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -26,7 +26,9 @@ PROXY ?= http://proxy.foo.com:8000 | |||
26 | NO_PROXY ?= localhost,127.0.0.1,.svc.cluster.local | 26 | NO_PROXY ?= localhost,127.0.0.1,.svc.cluster.local |
27 | USE_PROXY ?= false | 27 | USE_PROXY ?= false |
28 | PUSH_IMAGE ?= false | 28 | PUSH_IMAGE ?= false |
29 | COMMIT ?= commit-id | 29 | # use this variable for image labels added in internal build process |
30 | LABEL ?= com.internal | ||
31 | COMMIT ?= $(shell git rev-parse HEAD) | ||
30 | IMAGE_NAME := maas-rack-controller maas-region-controller sstream-cache | 32 | IMAGE_NAME := maas-rack-controller maas-region-controller sstream-cache |
31 | BUILD_DIR := $(shell mktemp -d) | 33 | BUILD_DIR := $(shell mktemp -d) |
32 | HELM := $(BUILD_DIR)/helm | 34 | HELM := $(BUILD_DIR)/helm |
@@ -67,7 +69,7 @@ helm-install: | |||
67 | .PHONY: build | 69 | .PHONY: build |
68 | build: | 70 | build: |
69 | ifeq ($(USE_PROXY), true) | 71 | ifeq ($(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) |
84 | else | 86 | else |
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)" \ |