Remove the dynamic plugin name calculation logic
* Removed the dynamic plugin name calculation logic for readability. * Hardcoded the make docker-image-<plugin_name> step for each plugin Change-Id: I79b3fc4aa899ee9b8ae2e8f308a6df8f4d1ac36f
This commit is contained in:
parent
ace0abae5d
commit
e9b317d641
67
Makefile
67
Makefile
@ -41,8 +41,11 @@ ifneq ($(strip $(DOCKER_BASE_RELEASE_IMAGE)),)
|
|||||||
DOCKER_CMD_FLAGS += --build-arg RELEASE_IMAGE=$(strip $(DOCKER_BASE_RELEASE_IMAGE))
|
DOCKER_CMD_FLAGS += --build-arg RELEASE_IMAGE=$(strip $(DOCKER_BASE_RELEASE_IMAGE))
|
||||||
endif
|
endif
|
||||||
# use this variable for image labels added in internal build process
|
# use this variable for image labels added in internal build process
|
||||||
LABEL ?= org.airshipit.build=community
|
|
||||||
COMMIT ?= $(shell git rev-parse HEAD)
|
COMMIT ?= $(shell git rev-parse HEAD)
|
||||||
|
LABEL ?= org.airshipit.build=community
|
||||||
|
LABEL += --label "org.opencontainers.image.revision=$(COMMIT)"
|
||||||
|
LABEL += --label "org.opencontainers.image.created=$(shell date --rfc-3339=seconds --utc)"
|
||||||
|
LABEL += --label "org.opencontainers.image.title=$(DOCKER_IMAGE_NAME)"
|
||||||
|
|
||||||
# go options
|
# go options
|
||||||
PKG ?= ./...
|
PKG ?= ./...
|
||||||
@ -87,7 +90,6 @@ export KUBECTL_URL ?= https://storage.googleapis.com/kubernetes-release/release
|
|||||||
# Plugins options
|
# Plugins options
|
||||||
PLUGINS_DIR := krm-functions
|
PLUGINS_DIR := krm-functions
|
||||||
PLUGINS := $(subst $(PLUGINS_DIR)/,,$(wildcard $(PLUGINS_DIR)/*))
|
PLUGINS := $(subst $(PLUGINS_DIR)/,,$(wildcard $(PLUGINS_DIR)/*))
|
||||||
PLUGINS_IMAGE_TGT := $(foreach tgt,$(PLUGINS),docker-image-$(tgt))
|
|
||||||
# use this variables to override base images in internal build process
|
# use this variables to override base images in internal build process
|
||||||
ifneq ($(strip $(DOCKER_BASE_PLUGINS_BUILD_IMAGE)),)
|
ifneq ($(strip $(DOCKER_BASE_PLUGINS_BUILD_IMAGE)),)
|
||||||
DOCKER_CMD_FLAGS += --build-arg PLUGINS_BUILD_IMAGE=$(strip $(DOCKER_BASE_PLUGINS_BUILD_IMAGE))
|
DOCKER_CMD_FLAGS += --build-arg PLUGINS_BUILD_IMAGE=$(strip $(DOCKER_BASE_PLUGINS_BUILD_IMAGE))
|
||||||
@ -154,15 +156,12 @@ golint:
|
|||||||
|
|
||||||
.PHONY: images
|
.PHONY: images
|
||||||
images: docker-image
|
images: docker-image
|
||||||
images: $(PLUGINS_IMAGE_TGT)
|
images: docker-image-kubeval-validator docker-image-cloud-init docker-image-replacement-transformer docker-image-templater docker-image-toolbox
|
||||||
|
|
||||||
.PHONY: docker-image
|
.PHONY: docker-image
|
||||||
docker-image:
|
docker-image:
|
||||||
@docker build . $(DOCKER_CMD_FLAGS) \
|
@docker build . $(DOCKER_CMD_FLAGS) \
|
||||||
--label $(LABEL) \
|
--label $(LABEL) \
|
||||||
--label "org.opencontainers.image.revision=$(COMMIT)" \
|
|
||||||
--label "org.opencontainers.image.created=$(shell date --rfc-3339=seconds --utc)" \
|
|
||||||
--label "org.opencontainers.image.title=$(DOCKER_IMAGE_NAME)" \
|
|
||||||
--target $(DOCKER_TARGET_STAGE) \
|
--target $(DOCKER_TARGET_STAGE) \
|
||||||
--build-arg MAKE_TARGET=$(DOCKER_MAKE_TARGET) \
|
--build-arg MAKE_TARGET=$(DOCKER_MAKE_TARGET) \
|
||||||
--tag $(DOCKER_IMAGE)
|
--tag $(DOCKER_IMAGE)
|
||||||
@ -170,20 +169,54 @@ ifeq ($(PUBLISH), true)
|
|||||||
@docker push $(DOCKER_IMAGE)
|
@docker push $(DOCKER_IMAGE)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
.PHONY: $(PLUGINS_IMAGE_TGT)
|
.PHONY: docker-image-templater
|
||||||
$(PLUGINS_IMAGE_TGT):
|
docker-image-templater:
|
||||||
$(eval plugin_name=$(subst docker-image-,,$@))
|
@docker build $(PLUGINS_DIR)/templater $(DOCKER_CMD_FLAGS) \
|
||||||
@docker build $(PLUGINS_DIR)/$(plugin_name) $(DOCKER_CMD_FLAGS) \
|
|
||||||
--label $(LABEL) \
|
--label $(LABEL) \
|
||||||
--label "org.opencontainers.image.revision=$(COMMIT)" \
|
|
||||||
--label "org.opencontainers.image.created=$(shell date --rfc-3339=seconds --utc)" \
|
|
||||||
--label "org.opencontainers.image.title=$(DOCKER_IMAGE_NAME)" \
|
|
||||||
--target $(DOCKER_TARGET_STAGE) \
|
--target $(DOCKER_TARGET_STAGE) \
|
||||||
--build-arg MAKE_TARGET=$(plugin_name) \
|
--tag $(DOCKER_REGISTRY)/$(DOCKER_IMAGE_PREFIX)/templater:$(DOCKER_IMAGE_TAG)
|
||||||
--build-arg BINARY=$(plugin_name) \
|
|
||||||
--tag $(DOCKER_REGISTRY)/$(DOCKER_IMAGE_PREFIX)/$(plugin_name):$(DOCKER_IMAGE_TAG)
|
|
||||||
ifeq ($(PUBLISH), true)
|
ifeq ($(PUBLISH), true)
|
||||||
@docker push $(DOCKER_REGISTRY)/$(DOCKER_IMAGE_PREFIX)/$(plugin_name):$(DOCKER_IMAGE_TAG)
|
@docker push $(DOCKER_REGISTRY)/$(DOCKER_IMAGE_PREFIX)/templater:$(DOCKER_IMAGE_TAG)
|
||||||
|
endif
|
||||||
|
|
||||||
|
.PHONY: docker-image-replacement-transformer
|
||||||
|
docker-image-replacement-transformer:
|
||||||
|
@docker build $(PLUGINS_DIR)/replacement-transformer $(DOCKER_CMD_FLAGS) \
|
||||||
|
--label $(LABEL) \
|
||||||
|
--target $(DOCKER_TARGET_STAGE) \
|
||||||
|
--tag $(DOCKER_REGISTRY)/$(DOCKER_IMAGE_PREFIX)/replacement-transformer:$(DOCKER_IMAGE_TAG)
|
||||||
|
ifeq ($(PUBLISH), true)
|
||||||
|
@docker push $(DOCKER_REGISTRY)/$(DOCKER_IMAGE_PREFIX)/replacement-transformer:$(DOCKER_IMAGE_TAG)
|
||||||
|
endif
|
||||||
|
|
||||||
|
.PHONY: docker-image-cloud-init
|
||||||
|
docker-image-cloud-init:
|
||||||
|
@docker build $(PLUGINS_DIR)/cloud-init $(DOCKER_CMD_FLAGS) \
|
||||||
|
--label $(LABEL) \
|
||||||
|
--target $(DOCKER_TARGET_STAGE) \
|
||||||
|
--tag $(DOCKER_REGISTRY)/$(DOCKER_IMAGE_PREFIX)/cloud-init:$(DOCKER_IMAGE_TAG)
|
||||||
|
ifeq ($(PUBLISH), true)
|
||||||
|
@docker push $(DOCKER_REGISTRY)/$(DOCKER_IMAGE_PREFIX)/cloud-init:$(DOCKER_IMAGE_TAG)
|
||||||
|
endif
|
||||||
|
|
||||||
|
.PHONY: docker-image-kubeval-validator
|
||||||
|
docker-image-kubeval-validator:
|
||||||
|
@docker build $(PLUGINS_DIR)/kubeval-validator $(DOCKER_CMD_FLAGS) \
|
||||||
|
--label $(LABEL) \
|
||||||
|
--target $(DOCKER_TARGET_STAGE) \
|
||||||
|
--tag $(DOCKER_REGISTRY)/$(DOCKER_IMAGE_PREFIX)/kubeval-validator:$(DOCKER_IMAGE_TAG)
|
||||||
|
ifeq ($(PUBLISH), true)
|
||||||
|
@docker push $(DOCKER_REGISTRY)/$(DOCKER_IMAGE_PREFIX)/kubeval-validator:$(DOCKER_IMAGE_TAG)
|
||||||
|
endif
|
||||||
|
|
||||||
|
.PHONY: docker-image-toolbox
|
||||||
|
docker-image-toolbox:
|
||||||
|
@docker build $(PLUGINS_DIR)/toolbox $(DOCKER_CMD_FLAGS) \
|
||||||
|
--label $(LABEL) \
|
||||||
|
--target $(DOCKER_TARGET_STAGE) \
|
||||||
|
--tag $(DOCKER_REGISTRY)/$(DOCKER_IMAGE_PREFIX)/toolbox:$(DOCKER_IMAGE_TAG)
|
||||||
|
ifeq ($(PUBLISH), true)
|
||||||
|
@docker push $(DOCKER_REGISTRY)/$(DOCKER_IMAGE_PREFIX)/toolbox:$(DOCKER_IMAGE_TAG)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
.PHONY: print-docker-image-tag
|
.PHONY: print-docker-image-tag
|
||||||
|
Loading…
Reference in New Issue
Block a user