云产品项目根目录下的 Makefile 用于定义云产品的打包流程,当前 Makefile 采用统一的定义,可直接使用如下代码:
HELM := helm
TASK := build
CHARTS := $(filter-out $(EXCLUDES), $(patsubst chart/%/.,%,$(wildcard chart/*/.)))
all: $(CHARTS)
$(CHARTS):
@echo
@echo "===== Processing [$@] chart ====="
@make $(TASK)-$@
init-%:
if [ -f chart/$*/Makefile ]; then make -C $*; fi
if [ -f chart/$*/requirements.yaml ]; then [ "$*" = "helm-toolkit" ] || (mkdir -p chart/$*/charts && cp helm-toolkit*.tgz chart/$*/charts); fi
lint-%: init-%
if [ -d chart/$* ]; then $(HELM) lint chart/$*; fi
build-%: lint-%
if [ -d chart/$* ]; then $(HELM) package --save=false chart/$*; fi
clean:
@echo "Removed _partials.tpl, and _globals.tpl files"
rm -f chart/*/templates/_partials.tpl
rm -f chart/*/templates/_globals.tpl
rm -f chart/*tgz *tgz chart/*/charts/*tgz
rm -f chart/*/requirements.lock
.PHONY: $(EXCLUDES) $(CHARTS)