Skip to content

Commit

Permalink
Run Helm chart unit tests on the Azure pipeline (#10195)
Browse files Browse the repository at this point in the history
Signed-off-by: Jakub Scholz <www@scholzj.com>
  • Loading branch information
scholzj committed Jun 5, 2024
1 parent de514f3 commit 7221769
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
19 changes: 18 additions & 1 deletion .azure/scripts/setup-helm.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/usr/bin/env bash
set -x

TEST_HELM3_VERSION=${TEST_HELM3_VERSION:-'v3.13.3'}
TEST_HELM3_VERSION=${TEST_HELM3_VERSION:-'v3.15.1'}
TEST_HELM_UNITTEST_VERSION=${TEST_HELM_UNITTEST_VERSION:-'v0.5.1'}

function install_helm3 {
export HELM_INSTALL_DIR=/usr/bin
Expand All @@ -24,4 +25,20 @@ function install_helm3 {
fi
}

function install_helm_unittest {
echo "Installing helm unittest plugin ..."
helm plugin install --version $TEST_HELM_UNITTEST_VERSION https://github.com/helm-unittest/helm-unittest.git

echo "Verifying the installation of helm unittest plugin ..."
# run a proper helm command instead of, for example, "which helm", to verify that we can call the binary
helm unittest --help
helmCommandOutput=$?

if [ $helmCommandOutput != 0 ]; then
echo "helm unittest plugin hasn't been installed properly - exiting..."
exit 1
fi
}

install_helm3
install_helm_unittest
2 changes: 2 additions & 0 deletions .azure/templates/jobs/build/build_strimzi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ jobs:
displayName: "Generate YAMLs from Helm Chart"
- bash: "make crd_install"
displayName: "Distribute CRDs"
- bash: "make helm_unittest"
displayName: "Run Helm Chart unit tests"
- bash: "make docu_versions"
displayName: "Generate docs version files"
- bash: "make docu_check"
Expand Down
3 changes: 2 additions & 1 deletion .azure/templates/steps/prerequisites/install_helm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ steps:
- bash: ".azure/scripts/setup-helm.sh"
displayName: "Install Helm"
env:
TEST_HELM3_VERSION: v3.13.3
TEST_HELM3_VERSION: v3.15.1
TEST_HELM_UNITTEST_VERSION: v0.5.1

0 comments on commit 7221769

Please sign in to comment.