Skip to content

Commit

Permalink
chore: introduce script to re-generate helm results (#3297)
Browse files Browse the repository at this point in the history
Signed-off-by: odubajDT <ondrej.dubaj@dynatrace.com>
Signed-off-by: odubajDT <93584209+odubajDT@users.noreply.github.com>
  • Loading branch information
odubajDT committed Mar 20, 2024
1 parent 1289d8a commit 7644cd7
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 16 deletions.
15 changes: 15 additions & 0 deletions .github/scripts/generate-helm-results.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

echo "re-generating Helm test results"
tests=$(find ./.github/scripts/.helm-tests -maxdepth 1 -mindepth 1 -type d )

# shellcheck source=.github/scripts/helm-utils.sh
source .github/scripts/helm-utils.sh

performHelmRepoUpdate

for test in $tests
do
echo "Re-generating $test"
helm template keptn-test --namespace helmtests -f $test/values.yaml ./chart > $test/result.yaml
done
19 changes: 4 additions & 15 deletions .github/scripts/helm-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,17 @@
# This script supports the comparison of standard values and expected templated results to helm chart
# it is used to make sure changes to the chart are intentional and produce expected outcomes

# shellcheck source=./.github/scripts/helm-utils.sh
source ./.github/scripts/helm-utils.sh

echo "running Helm tests"
tests=$(find ./.github/scripts/.helm-tests -maxdepth 1 -mindepth 1 -type d )

errors=0
successful=0
failures=""

helm repo add keptn "https://charts.lifecycle.keptn.sh"
helm repo update

for chart_dir in ./lifecycle-operator/chart \
./metrics-operator/chart \
./keptn-cert-manager/chart \
./chart; do
# shellcheck disable=SC2164
cd "$chart_dir"
echo "updating charts for" $chart_dir
helm dependency update
helm dependency build
# shellcheck disable=SC2164
cd - # Return to the previous directory
done
performHelmRepoUpdate

for test in $tests
do
Expand Down
19 changes: 19 additions & 0 deletions .github/scripts/helm-utils.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

performHelmRepoUpdate () {
helm repo add keptn "https://charts.lifecycle.keptn.sh"
helm repo update

for chart_dir in ./lifecycle-operator/chart \
./metrics-operator/chart \
./keptn-cert-manager/chart \
./chart; do
# shellcheck disable=SC2164
cd "$chart_dir"
echo "updating charts for" $chart_dir
helm dependency update
helm dependency build
# shellcheck disable=SC2164
cd - # Return to the previous directory
done
}
2 changes: 1 addition & 1 deletion .github/workflows/validate-helm-chart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,4 @@ jobs:
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Check if Helm template is up to date
run: ./.github/scripts/helm-test.sh
run: make helm-test
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,14 @@ operator-lint: install-golangci-lint
scheduler-lint: install-golangci-lint
$(MAKE) -C scheduler lint

.PHONY: helm-test
helm-test:
./.github/scripts/helm-test.sh

.PHONY: generate-helm-test-results
generate-helm-test-results:
./.github/scripts/generate-helm-results.sh

.PHONY: lint
lint: metrics-operator-lint
lint: certmanager-lint
Expand Down

0 comments on commit 7644cd7

Please sign in to comment.