Skip to content

Commit dd6df63

Browse files
fix(helm-unittest): support helm 4 (#520)
Signed-off-by: Gabriel Martinez <gabrielmartinez@sisti.pt>
1 parent 3bca1dc commit dd6df63

4 files changed

Lines changed: 63 additions & 23 deletions

File tree

.github/workflows/lint-test.yaml

Lines changed: 40 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ name: Lint and Test Charts
33
on:
44
pull_request:
55
paths:
6-
- 'charts/atlantis/**'
7-
- 'ct.yaml'
6+
- "charts/atlantis/**"
7+
- "ct.yaml"
88

99
defaults:
1010
run:
@@ -30,7 +30,7 @@ jobs:
3030
- uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6
3131
with:
3232
# renovate: datasource=docker depName=python
33-
python-version: '3.14'
33+
python-version: "3.14"
3434
check-latest: true
3535

3636
- name: Set up chart-testing
@@ -61,10 +61,45 @@ jobs:
6161
echo "Documentation is up to date." >&2
6262
fi
6363
64-
- name: Install helm unittests
64+
# - name: Install helm unittests
65+
# if: steps.list-changed.outputs.changed == 'true'
66+
# run: |
67+
# make unit-test-install
68+
69+
# Required until https://github.com/helm-unittest/helm-unittest/issues/777 is fixed
70+
- name: Install helm-unittest plugin with checksum validation
6571
if: steps.list-changed.outputs.changed == 'true'
72+
shell: bash
6673
run: |
67-
make unit-test-install
74+
set -euo pipefail
75+
76+
VERSION="1.0.3" # without v
77+
ARCH="$(uname -m)"
78+
79+
case "${ARCH}" in
80+
x86_64)
81+
ARCH=amd64
82+
SUM="12a9ef198e21166fe5f7487544903d91355b4ea08b1d59220f1543234caf4371"
83+
;;
84+
aarch64|arm64)
85+
ARCH=arm64
86+
SUM="540aec896945e0e26f443b0d1976d556ce0a3bfa7b10255ed1beecc8d2f7a1cc"
87+
;;
88+
*)
89+
echo "Unsupported arch: ${ARCH}"
90+
exit 1
91+
;;
92+
esac
93+
94+
ASSET="helm-unittest-linux-${ARCH}-${VERSION}.tgz"
95+
96+
wget "https://github.com/helm-unittest/helm-unittest/releases/download/v${VERSION}/${ASSET}"
97+
echo "${SUM} ${ASSET}" | sha256sum -c
98+
99+
mkdir -p "$(helm env HELM_PLUGINS)/${ASSET%.*}"
100+
tar -xzf "${ASSET}" -C "$(helm env HELM_PLUGINS)/${ASSET%.*}"
101+
102+
helm plugin list
68103
69104
- name: Run chart-testing (lint)
70105
if: steps.list-changed.outputs.changed == 'true'
@@ -73,7 +108,6 @@ jobs:
73108
--config ct.yaml \
74109
--target-branch ${{ github.event.repository.default_branch }}
75110
76-
77111
- name: Create kind cluster
78112
if: steps.list-changed.outputs.changed == 'true'
79113
uses: helm/kind-action@92086f6be054225fa813e0a4b13787fc9088faab # v1.13.0

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ docs: ## Build helm chart documentation
1111

1212
.PHONY: unit-test-install
1313
unit-test-install:
14-
@helm plugin list | grep unittest || helm plugin install --version v0.3.6 https://github.com/helm-unittest/helm-unittest
14+
@helm plugin list | grep unittest || helm plugin install --version v1.0.3 https://github.com/helm-unittest/helm-unittest
1515

1616
.PHONY: unit-test-run-atlantis
1717
unit-test-run-atlantis: unit-test-install ## Run unit tests for Atlantis

charts/atlantis/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apiVersion: v1
33
appVersion: v0.37.1
44
description: A Helm chart for Atlantis https://www.runatlantis.io
55
name: atlantis
6-
version: 5.21.0
6+
version: 5.21.1
77
keywords:
88
- terraform
99
home: https://www.runatlantis.io

charts/atlantis/tests/misc_test.yaml

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,37 +9,43 @@ release:
99
tests:
1010
- it: ensure namespaces are specified in all resources
1111
set:
12-
config: "dummy"
12+
config: dummy
1313
gitconfigReadOnly: false
14-
gitconfig: "dummy"
14+
gitconfig: dummy
1515
initConfig:
1616
enabled: true
17-
repoConfig: "dummy"
17+
repoConfig: dummy
1818
podMonitor:
1919
enabled: true
2020
servicemonitor:
2121
enabled: true
2222
enableKubernetesBackend: true
2323
api:
24-
secret: "dummy"
24+
secret: dummy
2525
aws:
26-
config: "dummy"
26+
config: dummy
2727
basicAuth:
28-
username: "dummy"
29-
password: "dummy"
30-
netrc: "dummy"
28+
username: dummy
29+
password: dummy
30+
netrc: dummy
3131
redis:
32-
password: "dummy"
32+
password: dummy
3333
serviceAccountSecrets:
34-
credentials: "dummy"
34+
credentials: dummy
3535
webhook_ingress:
3636
enabled: true
3737
extraManifests:
38-
- apiVersion: v1
39-
kind: Pod
40-
metadata:
41-
name: dummy
42-
namespace: "my-namespace"
38+
- apiVersion: v1
39+
kind: Pod
40+
metadata:
41+
name: dummy-manifest
42+
namespace: my-namespace
43+
extraSecretManifests:
44+
- apiVersion: v1
45+
kind: Pod
46+
metadata:
47+
name: dummy-secret
48+
namespace: my-namespace
4349

4450
asserts:
4551
- equal:

0 commit comments

Comments
 (0)