Skip to content

Commit

Permalink
add scripts for helm testing
Browse files Browse the repository at this point in the history
  • Loading branch information
huww98 committed Aug 28, 2024
1 parent 9da19dd commit 957c145
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
18 changes: 18 additions & 0 deletions hack/check-helm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash
# We need a clean Kubernetes cluster to run this script.

set -e

cd deploy/chart

kubectl create -f ./crds

helm lint
helm install alibaba-cloud-csi-driver . --namespace kube-system --dry-run=server

for v in values-*.yaml; do
helm lint --values "$v"
helm install alibaba-cloud-csi-driver . --namespace kube-system --dry-run=server --values "$v"
done

kubectl delete -f ./crds
19 changes: 19 additions & 0 deletions test/install-or-upgrade.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
# If helm chart is changed, try install upstream version, then upgrade to local version,
# to ensure all changes are valid. e.g. we don't change some immutable fields.

set -e

UPSTREAM=${UPSTREAM:-"origin/master"}

if ! git diff --exit-code --stat "$UPSTREAM" HEAD -- deploy/chart; then
echo "helm chart is changed, installing $UPSTREAM version first"
git worktree add --detach --no-checkout ../upstream "$UPSTREAM"
( cd ../upstream && git checkout HEAD -- deploy/chart )

helm install --namespace kube-system alibaba-cloud-csi-driver ../upstream/deploy/chart "$@"
git worktree remove --force ../upstream
fi

echo installing local version
helm upgrade --install --namespace kube-system alibaba-cloud-csi-driver ./deploy/chart "$@"

0 comments on commit 957c145

Please sign in to comment.