From d28e18766a5605b05917e2dbbf69b39ea9860dc7 Mon Sep 17 00:00:00 2001 From: Stefan Reimer Date: Thu, 21 Jan 2021 10:53:53 +0000 Subject: [PATCH] CI/CD tools update --- .helmdocsignore | 6 ++---- Makefile | 9 ++++++++- README.md | 4 ++-- charts/kubezero/README.md | 2 +- scripts/publish.sh | 27 +++++++++++++++++++-------- 5 files changed, 32 insertions(+), 16 deletions(-) diff --git a/.helmdocsignore b/.helmdocsignore index 8fc08f21..688e7713 100644 --- a/.helmdocsignore +++ b/.helmdocsignore @@ -1,4 +1,2 @@ -# Ignore sub-charts -charts/*/charts/* -charts/kubezero-lib -deploy +# Only our own charts, see Makefile +charts/ diff --git a/Makefile b/Makefile index aebd4c59..bc4204f8 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ BUCKET ?= zero-downtime BUCKET_PREFIX ?= /cloudbender/distfiles FILES ?= distfiles.txt -.PHONY: clean update +.PHONY: clean update docs all: update @@ -12,3 +12,10 @@ clean: update: ./script/update_helm.sh + +docs: + for c in charts/*; do \ + [[ $$c =~ "kubezero-lib" ]] && continue ; \ + [[ $$c =~ "kubeadm" ]] && continue ; \ + helm-docs -c $$c ; \ + done diff --git a/README.md b/README.md index 060056e9..ec6247b3 100644 --- a/README.md +++ b/README.md @@ -15,10 +15,10 @@ All chosen components are 100% organic OpenSource. # Version / Support Matrix -| KubeZero \ Kubernetes Version | v1.17 | v1.18 | v1.19 | v1.20+| EOL | +| KubeZero \ Kubernetes Version | v1.17 | v1.18 | v1.19 | v1.20 | EOL | |----------------------------------------|-------|-------|-------|-------|-------------| | master branch | no | yes | beta | no | | -| stable branch | yes | no | no | no | | +| stable branch | no | yes | no | no | | | v2.18.0 | no | yes | no | no | 30 Apr 2021 | | v1 | yes | no | no | no | 30 Jan 2021 | diff --git a/charts/kubezero/README.md b/charts/kubezero/README.md index 2ae02fd1..3cdae9d5 100644 --- a/charts/kubezero/README.md +++ b/charts/kubezero/README.md @@ -60,4 +60,4 @@ Kubernetes: `>= 1.16.0` | metrics.namespace | string | `"monitoring"` | | ---------------------------------------------- -Autogenerated from chart metadata using [helm-docs v1.2.1](https://github.com/norwoodj/helm-docs/releases/v1.2.1) +Autogenerated from chart metadata using [helm-docs v1.5.0](https://github.com/norwoodj/helm-docs/releases/v1.5.0) diff --git a/scripts/publish.sh b/scripts/publish.sh index 88fcac42..06076515 100755 --- a/scripts/publish.sh +++ b/scripts/publish.sh @@ -1,5 +1,5 @@ #!/bin/bash -set -eux +set -eu CHARTS=${1:-'.*'} # all credits go to the argoproj Helm guys https://github.com/argoproj/argo-helm @@ -7,9 +7,14 @@ CHARTS=${1:-'.*'} SRCROOT="$(cd "$(dirname "$0")/.." && pwd)" GIT_PUSH=${GIT_PUSH:-true} -rm -rf $SRCROOT/output && git clone -b gh-pages ssh://git@git.zero-downtime.net:22000/ZeroDownTime/KubeZero.git $SRCROOT/output +[ "$(git branch --show-current)" == "stable" ] || { echo "Helm packages should only be built from stable branch !"; exit 1; } + +TMPDIR=$(mktemp -d kubezero-repo.XXX) +mkdir -p $TMPDIR/stage + +git clone -b gh-pages ssh://git@git.zero-downtime.net:22000/ZeroDownTime/KubeZero.git $TMPDIR/repo # Reset all -# rm -rf $SRCROOT/output/*tgz $SRCROOT/output/index.yaml +# rm -rf $TMPDIR/repo/*tgz $TMPDIR/repo/index.yaml helm repo add argoproj https://argoproj.github.io/argo-helm helm repo add jetstack https://charts.jetstack.io @@ -29,15 +34,21 @@ do echo "Processing $dir" helm lint $dir || true - helm --debug package $dir + helm --debug package -d $TMPDIR/stage $dir done -cp $SRCROOT/*.tgz output/ -cd $SRCROOT/output && helm repo index . +# Do NOT overwrite existing charts +cp -n $TMPDIR/stage/*.tgz $TMPDIR/repo -cd $SRCROOT/output && git status +cd $TMPDIR/repo + +helm repo index . +git status if [ "$GIT_PUSH" == "true" ] then - cd $SRCROOT/output && git add . && git commit -m "Publish charts" && git push ssh://git@git.zero-downtime.net:22000/ZeroDownTime/KubeZero.git gh-pages + git add . && git commit -m "Publish charts" && git push ssh://git@git.zero-downtime.net:22000/ZeroDownTime/KubeZero.git gh-pages fi + +cd - +rm -rf $TMPDIR