From 150653a43c1f2519a5bb006fcd73ef64a6f0abd5 Mon Sep 17 00:00:00 2001 From: Soule BA Date: Thu, 1 Aug 2024 11:57:15 +0200 Subject: [PATCH] Add a target to build helm-docs from a branch Signed-off-by: Soule BA --- Makefile | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 751a81f..1976290 100644 --- a/Makefile +++ b/Makefile @@ -17,11 +17,13 @@ $(TOOLSDIR): $(BUILDDIR): ; $(info Creating build directory...) mkdir -p $@ +BRANCH ?= master # Paths to download the helm chart to. HELM_CHART_DEP_ROOT ?= $(BUILDDIR)/helmcharts # Helm chart version and url HELM_CHART_VERSION ?= 24.4.1 -NGC_HELM_CHART_URL ?= https://helm.ngc.nvidia.com/nvidia/charts +NGC_HELM_CHART_URL ?= https://helm.ngc.nvidia.com/nvidia/charts/network-operator-${HELM_CHART_VERSION}.tgz +BRANCH_HELM_CHART_URL ?= https://github.com/Mellanox/network-operator/archive/refs/heads/${BRANCH}.tar.gz build-docs: helm-docs ./repo.sh docs @@ -43,8 +45,21 @@ define go-install-tool $Q mv $(TOOLSDIR)/$(2) $(TOOLSDIR)/$(2)-$(3) endef + +download-ngc-helm-chart: + mkdir -p ${HELM_CHART_DEP_ROOT} && cd ${HELM_CHART_DEP_ROOT} \ + && curl -sL ${NGC_HELM_CHART_URL} | tar -xz + +download-branch-helm-chart: + mkdir -p ${HELM_CHART_DEP_ROOT} \ + && curl -sL ${BRANCH_HELM_CHART_URL} \ + | tar -xz -C ${HELM_CHART_DEP_ROOT} \ + --strip-components 2 network-operator-${BRANCH}/deployment/network-operator + # Generate helm chart documentation in a reStructuredText format. helm-docs: $(HELM_DOCS) - mkdir -p ${HELM_CHART_DEP_ROOT} && cd ${HELM_CHART_DEP_ROOT} && curl -sL ${NGC_HELM_CHART_URL}/network-operator-${HELM_CHART_VERSION}.tgz | tar xz - $(HELM_DOCS) --output-file=../../../../docs/customizations/helm.rst --ignore-file=.helmdocsignore --template-files=./templates/helm.rst.gotmpl ${HELM_CHART_DEP_ROOT}/network-operator + $(HELM_DOCS) --output-file=../../../../docs/customizations/helm.rst --ignore-file=.helmdocsignore --template-files=./templates/helm.rst.gotmpl ${HELM_CHART_DEP_ROOT} + +ngc-helm-docs: download-ngc-helm-chart helm-docs +branch-helm-docs: download-branch-helm-chart helm-docs