diff --git a/.github/actions/setup-deps/action.yml b/.github/actions/setup-deps/action.yml index 9326a19831..960def637b 100644 --- a/.github/actions/setup-deps/action.yml +++ b/.github/actions/setup-deps/action.yml @@ -34,4 +34,9 @@ runs: - name: "Install Python requirements with pip" shell: bash run: python -m pip install awscli packaging - + # Helm Deps + - name: "Install Helm Dependencies" + shell: bash + run: | + helm repo add agent https://s3.amazonaws.com/datawire-static-files/charts + helm repo update diff --git a/Makefile b/Makefile index 18b45ca1e3..5421464752 100644 --- a/Makefile +++ b/Makefile @@ -74,6 +74,27 @@ $(call module,ambassador,$(OSS_HOME)) include $(OSS_HOME)/build-aux/generate.mk include $(OSS_HOME)/build-aux/lint.mk +HELM_TEST_IMAGE = quay.io/helmpack/chart-testing:v3.0.0-rc.1 +CHART_DIR := $(OSS_HOME)/build-output/chart-$(patsubst v%,%,$(VERSION))_$(patsubst v%,%,$(CHART_VERSION)).d +CT_EXEC = docker run --rm -v $(KIND_KUBECONFIG):/root/.kube/config -v $(CHART_DIR) --network host $(HELM_TEST_IMAGE) $(CHART_DIR)/ci.in/ct.sh + +chart/lint: preflight-dev-kubeconfig + $(CT_EXEC) lint --config /ct.yaml +.PHONY: chart/lint + +chart/k3d-test: preflight-dev-kubeconfig + # check if k3d is installed + @if ! command -v k3d 2> /dev/null ; then \ + printf 'k3d not installed, please do that'; \ + false; \ + fi +.PHONY: chart/k3d-test + +chart/test: chart/lint chart/k3d-test ci/setup-k3d + $(CT_EXEC) install --config /ct.yaml && \ + $(MAKE) chart/delete-cluster +.PHONY: chart/test + .git/hooks/prepare-commit-msg: ln -s $(OSS_HOME)/tools/hooks/prepare-commit-msg $(OSS_HOME)/.git/hooks/prepare-commit-msg @@ -90,9 +111,10 @@ deploy: push preflight-cluster $(MAKE) deploy-only .PHONY: deploy -deploy-only: preflight-dev-kubeconfig $(tools/kubectl) build-output/yaml-$(patsubst v%,%,$(VERSION)) $(boguschart_dir) +deploy-only: preflight-dev-kubeconfig chart/test $(tools/kubectl) build-output/yaml-$(patsubst v%,%,$(VERSION)) $(boguschart_dir) mkdir -p $(OSS_HOME)/build/helm/ && \ ($(tools/kubectl) --kubeconfig $(DEV_KUBECONFIG) create ns ambassador || true) && \ + helm dependency build && \ helm template ambassador --output-dir $(OSS_HOME)/build/helm -n ambassador $(boguschart_dir) \ --set createNamespace=true \ --set service.selector.service=ambassador \ diff --git a/build-aux/generate.mk b/build-aux/generate.mk index df48b5be1d..d4fc3e03df 100644 --- a/build-aux/generate.mk +++ b/build-aux/generate.mk @@ -207,7 +207,11 @@ helm.namespace.emissary-defaultns-migration = default # IF YOU'RE LOOKING FOR *.yaml: recipes, look in main.mk. -$(OSS_HOME)/k8s-config/%/helm-expanded.yaml: \ +helm-dependency: $(boguschart_dir) + cd $(boguschart_dir) && helm dependency build +.PHONY: helm-dependency + +$(OSS_HOME)/k8s-config/%/helm-expanded.yaml: helm-dependency \ $(OSS_HOME)/k8s-config/%/values.yaml \ $(boguschart_dir) helm template --namespace=$(helm.namespace.$*) --values=$(@D)/values.yaml $(or $(helm.name.$*),$*) $(boguschart_dir) >$@ diff --git a/build-aux/main.mk b/build-aux/main.mk index aa27fe4fcf..cc04f9a0f7 100644 --- a/build-aux/main.mk +++ b/build-aux/main.mk @@ -130,6 +130,7 @@ endif } $(tools/chart-doc-gen) -d $$@/README.md build-output/chart-%.tgz: build-output/chart-%.d + cd $< && helm dependency build helm package --destination=$< $< mv $