From 9f6d3798e5973ef461f3ba8b401ff4feb886703d Mon Sep 17 00:00:00 2001 From: Bassam Tabbara Date: Thu, 10 Aug 2017 13:26:45 -0700 Subject: [PATCH] build: publish and promote helm charts we now support charts.rook.io --- Makefile | 6 ++++-- .../charts/Makefile => build/makelib/helm.mk | 14 +++----------- build/release/Makefile | 17 ++++++++++++++++- 3 files changed, 23 insertions(+), 14 deletions(-) rename cluster/charts/Makefile => build/makelib/helm.mk (90%) diff --git a/Makefile b/Makefile index 2c44dc3f8..ca671bfab 100644 --- a/Makefile +++ b/Makefile @@ -86,6 +86,9 @@ GO_TEST_SUITE=$(SUITE) include build/makelib/golang.mk +# setup helm charts +include build/makelib/helm.mk + # ==================================================================================== # Targets @@ -93,10 +96,9 @@ build.version: @mkdir -p $(OUTPUT_DIR) @echo "$(VERSION)" > $(OUTPUT_DIR)/version -build.common: build.version +build.common: build.version helm.build @$(MAKE) go.init @$(MAKE) go.validate - @$(MAKE) -C cluster/charts do.build.platform.%: @$(MAKE) PLATFORM=$* go.build diff --git a/cluster/charts/Makefile b/build/makelib/helm.mk similarity index 90% rename from cluster/charts/Makefile rename to build/makelib/helm.mk index 83e4b98c9..f345c21e4 100644 --- a/cluster/charts/Makefile +++ b/build/makelib/helm.mk @@ -12,18 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -# remove default suffixes as we dont use them -.SUFFIXES: - -# include the common make file -include ../../build/makelib/common.mk - -.PHONY: all -all: build - # the helm charts to build HELM_CHARTS ?= rook -HELM_URL ?= https://release.rook.io/charts +HELM_BASE_URL ?= https://charts.rook.io +HELM_S3_BUCKET ?= rook-charts HELM_CHARTS_DIR ?= $(ROOT_DIR)/cluster/charts HELM_OUTPUT_DIR ?= $(OUTPUT_DIR)/charts @@ -59,4 +51,4 @@ $(HELM_INDEX): $(HELM) $(HELM_OUTPUT_DIR) @echo === helm index @$(HELM) repo index $(HELM_OUTPUT_DIR) -build: $(HELM_INDEX) +helm.build: $(HELM_INDEX) diff --git a/build/release/Makefile b/build/release/Makefile index 29b6d1fac..b98c31610 100644 --- a/build/release/Makefile +++ b/build/release/Makefile @@ -15,6 +15,7 @@ all: build include ../makelib/common.mk +include ../makelib/helm.mk # ==================================================================================== # Options @@ -48,7 +49,7 @@ REMOTE_NAME ?= origin PLATFORMS ?= $(ALL_PLATFORMS) ifneq ($(filter master release-%,$(BRANCH_NAME)),) -FLAVORS ?= output images docs +FLAVORS ?= output images docs helm else FLAVORS ?= output override BRANCH_NAME := pr/$(BRANCH_NAME) @@ -124,6 +125,20 @@ build.docs: publish.docs: $(DOCS_WORK_DIR)/build/publish.sh +# ==================================================================================== +# helm + +HELM_TEMP := $(shell mktemp -d) +HELM_URL := $(HELM_BASE_URL)/$(CHANNEL) + +promote.helm: +# copy existing charts to a temp dir, the combine with new charts, reindex, and upload + @$(S3_SYNC) s3://$(HELM_S3_BUCKET)/$(CHANNEL) $(HELM_TEMP) + @$(S3_SYNC) s3://$(S3_BUCKET)/build/$(BRANCH_NAME)/$(VERSION)/charts $(HELM_TEMP) + @$(HELM) repo index --url $(HELM_URL) $(HELM_TEMP) + @$(S3_SYNC) $(HELM_TEMP) s3://$(HELM_S3_BUCKET)/$(CHANNEL) + @rm -fr $(HELM_TEMP) + # ==================================================================================== # output