Skip to content

Commit e4b34ca

Browse files
committed
fix(helm): immutable unittest runner and fail-closed version gate in CI
- helm-unittest runs via the project's official docker image pinned by immutable sha256 digest instead of a plugin install from a mutable git tag - the version-bump gate fetches the full base ref (a --depth=1 fetch could leave no merge base), computes the merge-base and diff outside the if so any git failure fails the job instead of falling into the skip branch
1 parent f9a9964 commit e4b34ca

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

.github/workflows/helm.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,9 @@ jobs:
3737

3838
- name: Helm unit tests
3939
run: |
40-
helm plugin install https://github.com/helm-unittest/helm-unittest --version v0.8.2
41-
helm unittest helm/sim
40+
# Official helm-unittest image, pinned by immutable digest (tag 3.17.3-0.8.2)
41+
docker run --rm -v "$PWD/helm/sim:/apps" \
42+
helmunittest/helm-unittest@sha256:b653db7d5665bc6cec677b15c5eaa1c0377c0de8ac4eb1df58b924478baa21e1 .
4243
4344
- name: Install kubeconform
4445
run: |
@@ -99,9 +100,11 @@ jobs:
99100
run: |
100101
set -euo pipefail
101102
base="origin/${{ github.base_ref }}"
102-
git fetch origin "${{ github.base_ref }}" --depth=1
103-
if git diff --name-only "$base"...HEAD | grep -q '^helm/sim/'; then
104-
base_version=$(git show "$base:helm/sim/Chart.yaml" | awk '/^version:/ {print $2}')
103+
git fetch origin "${{ github.base_ref }}"
104+
merge_base=$(git merge-base "$base" HEAD)
105+
changed=$(git diff --name-only "$merge_base" HEAD)
106+
if echo "$changed" | grep -q '^helm/sim/'; then
107+
base_version=$(git show "$merge_base:helm/sim/Chart.yaml" | awk '/^version:/ {print $2}')
105108
head_version=$(awk '/^version:/ {print $2}' helm/sim/Chart.yaml)
106109
echo "base=$base_version head=$head_version"
107110
if [ "$base_version" = "$head_version" ]; then

0 commit comments

Comments
 (0)