From af14de07e72d2bdabfba59a7def606c30060dae3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20=27Perk=27=20Sto=C5=BCek?= Date: Thu, 8 Oct 2020 13:34:58 +0200 Subject: [PATCH] Fix: do not change timestamps for already existing helm charts The command `helm repo index` is changing timestamps for already existing charts. This seems to be intended: https://github.com/helm/helm/issues/7363 Helm stable repo tests use this workaround: https://github.com/helm/charts/blob/c6e503ccfd9911dd06ea9ac389a40a3490637516/test/repo-sync.sh#L83-L90 This commit adds the mentioned workaround to our build. --- ci/build.sh | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/ci/build.sh b/ci/build.sh index 0600b541fe..d799408f5f 100755 --- a/ci/build.sh +++ b/ci/build.sh @@ -213,16 +213,29 @@ function push_docker_image() { function push_helm_chart() { local version="$1" + local sync_dir="${TRAVIS_BUILD_DIR}-helm-sync" + echo "Pushing new Helm Chart release $version" set -x + git checkout -- . sudo helm init --client-only sudo helm repo add falcosecurity https://falcosecurity.github.io/charts sudo helm repo add prometheus-community https://prometheus-community.github.io/helm-charts - sudo helm package deploy/helm/sumologic --dependency-update --version="$version" --app-version="$version" + + # due to helm repo index issue: https://github.com/helm/helm/issues/7363 + # we need to create new package in a different dir, merge the index and move the package back + mkdir -p "${sync_dir}" + sudo helm package deploy/helm/sumologic --dependency-update --version="$version" --app-version="$version" --destination "${sync_dir}" + git fetch origin-repo git checkout gh-pages - sudo helm repo index ./ --url https://sumologic.github.io/sumologic-kubernetes-collection/ + + sudo helm repo index --url https://sumologic.github.io/sumologic-kubernetes-collection/ --merge ./index.yaml "${sync_dir}" + + mv -f "${sync_dir}"/* . + rmdir "${sync_dir}" + git add -A git commit -m "Push new Helm Chart release $version" git push --quiet origin-repo gh-pages