Skip to content

Commit

Permalink
chore: make sure installed chartsnap version matches desired
Browse files Browse the repository at this point in the history
  • Loading branch information
czeslavo committed Apr 30, 2024
1 parent 3fdef5c commit 3b2e0bf
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ kube-linter:

.PHONY: chartsnap
chartsnap:
@helm plugin list | grep chartsnap > /dev/null || \
helm plugin install https://github.com/jlandowner/helm-chartsnap --version $(CHARTSNAP_VERSION)
./scripts/install-chartsnap.sh

.PHONY: lint
lint: tools lint.charts.kong lint.shellcheck
Expand Down
15 changes: 15 additions & 0 deletions scripts/install-chartsnap.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

CHARTSNAP_VERSION="0.3.1"

# Only install the plugin if it is not already installed or if the version is different.
if [[ $(helm plugin list | grep chartsnap | grep -Eo '[0-9]{1,}.[0-9]{1,}.[0-9]{1,}') == "${CHARTSNAP_VERSION}" ]]; then
echo "INFO: chartsnap plugin is already installed and up to date"
else
echo "INFO: Installing chartsnap plugin"
if [ $(helm plugin list | grep -ic chartsnap) -eq 1 ]; then
echo "INFO: Uninstalling existing chartsnap plugin - version mismatch"
helm plugin uninstall chartsnap
fi
helm plugin install https://github.com/jlandowner/helm-chartsnap --version "${CHARTSNAP_VERSION}"
fi

0 comments on commit 3b2e0bf

Please sign in to comment.