From 6a70c23e2d1b46ed6b2c2d934ad571ee01c2281a Mon Sep 17 00:00:00 2001 From: Adar Nimrod <nimrod@shore.co.il> Date: Wed, 8 Dec 2021 23:16:10 +0200 Subject: [PATCH] Helm plugins. - Add the 2to3 and push plugins. - Nicer handling of installation of a specific version of a plugin. --- .githooks/post-merge | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/.githooks/post-merge b/.githooks/post-merge index d8d8a92..5f9c97e 100755 --- a/.githooks/post-merge +++ b/.githooks/post-merge @@ -3,6 +3,25 @@ set -eu notify () { printf '\n\e[1;94m=== %s ====\e[0m\n\n' "$1" >&2; } +helm_install () { + name="$1" + url="$2" + version="${3:-}" + if [ -z "$version" ] + then + if ! helm plugin list | grep -qw "^$name" + then + helm plugin install "$url" + fi + else + if [ "$version" != "$(helm plugin list | awk "\$1 == \"$name\" {print \$2}")" ] + then + helm plugin uninstall "$name" || true + helm plugin install "$url" --version "$version" + fi + fi +} + cd "$(git rev-parse --show-toplevel)" notify 'Generating some configuration and private files.' make --directory "$HOME" --always-make --keep-going || true @@ -26,6 +45,7 @@ if command -v helm > /dev/null then notify 'Installing Helm plugins' eval "$(grep 'export HELM_HOME' .bashrc)" - helm plugin list | { ! grep --silent '^diff'; } || helm plugin remove diff - helm plugin install https://github.com/databus23/helm-diff --version master + helm_install diff https://github.com/databus23/helm-diff.git + helm_install 2to3 https://github.com/helm/helm-2to3.git + helm_install cm-push https://github.com/chartmuseum/helm-push.git fi -- GitLab