From f32faac646c5fd0c813f112b196f760517348d0b Mon Sep 17 00:00:00 2001 From: Stefan Riepenhausen Date: Tue, 20 Dec 2022 15:27:50 +0100 Subject: [PATCH] add mandatory variables --- Makefile | 14 +++++++++++++- docker.mk | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 05b8d56..adf5f6b 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,19 @@ include make-deploy/helm.mk self-update: @- git submodule update --remote -deploy: build test upload pre-deploy pre-local pull start post-local post-deploy reload +deploy: mandatory build test upload pre-deploy pre-local pull start post-local post-deploy reload + +mandatory: + @- echo "\n### mandatory check" +ifndef MANDATORY-$(DEPLOY_TYPE) + $(error MANDATORY-$(DEPLOY_TYPE) is not defined) +endif + @ $(foreach var,$(MANDATORY), \ + if test -z "${$(var)}"; then \ + echo "Missing mandatory variable: $(var)"; \ + exit 1; \ + fi; \ + ) build: ifneq (,$(wildcard build.sh)) diff --git a/docker.mk b/docker.mk index 1b418ae..28144ff 100644 --- a/docker.mk +++ b/docker.mk @@ -1,3 +1,4 @@ +MANDATORY-compose = DEPLOY_HOSTS DEPLOY_TYPE TAG pull-compose: @- echo "\n### pulling image(s)" @- $(foreach host,$(DEPLOY_HOSTS), \