Skip to content

Commit d78d1b8

Browse files
committed
Improve helm checking
Signed-off-by: Gavin Halliday <[email protected]>
1 parent bb52776 commit d78d1b8

File tree

2 files changed

+54
-7
lines changed

2 files changed

+54
-7
lines changed

.github/workflows/test-helm.yml

+53-6
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
name: "Check helm chart lint"
3939
runs-on: ubuntu-20.04
4040
needs: pre_job
41-
if: ${{ github.repository == 'hpcc-systems/HPCC-Platform' && needs.pre_job.outputs.helm }}
41+
#if: ${{ github.repository == 'hpcc-systems/HPCC-Platform' && needs.pre_job.outputs.helm }}
4242
steps:
4343
- uses: actions/checkout@v4
4444
with:
@@ -57,8 +57,55 @@ jobs:
5757
- name: Check for changes in helm output for default values
5858
working-directory: .
5959
run: |
60-
helm template helm/hpcc > ${{ runner.temp }}/newoutput.txt
61-
git fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin ${{ github.base_ref }}
62-
git checkout ${{ github.base_ref }}
63-
helm template helm/hpcc > ${{ runner.temp }}/oldoutput.txt
64-
diff ${{ runner.temp }}/oldoutput.txt ${{ runner.temp }}/newoutput.txt
60+
resultcode=0
61+
mkdir ${{ runner.temp }}/new
62+
mkdir ${{ runner.temp }}/old
63+
64+
#Generate the output for the default values file, and each of the specialised test files.
65+
#Check to see if anything has changed between old and new, and report the differences
66+
helm template helm/hpcc > ${{ runner.temp }}/new/output.txt
67+
for file in testing/helm/tests/*.yaml
68+
do
69+
tail=$(basename $file)
70+
helm template helm/hpcc --values $file > ${{ runner.temp }}/new/$tail.txt
71+
done
72+
73+
if [[ ${{ github.event_name }} == 'pull_request' ]]
74+
then
75+
git fetch --no-tags --prune --progress --no-recurse-submodules --quiet --depth=1 origin ${{ github.base_ref }}
76+
echo git checkout ${{ github.base_ref }}
77+
git checkout ${{ github.base_ref }}
78+
else
79+
git checkout HEAD^
80+
fi
81+
82+
helm template helm/hpcc > ${{ runner.temp }}/old/output.txt
83+
for file in testing/helm/tests/*.yaml
84+
do
85+
tail=$(basename $file)
86+
helm template helm/hpcc --values $file > ${{ runner.temp }}/old/$tail.txt
87+
done
88+
89+
diff ${{ runner.temp }}/old/output.txt ${{ runner.temp }}/new/output.txt
90+
if [ $? -ne 0 ]
91+
then
92+
resultcode=1
93+
else
94+
#Only check for differences in the specialised test files if the default values file is the same
95+
for file in testing/helm/tests/*.yaml
96+
do
97+
tail=$(basename $file)
98+
echo Check $tail
99+
diff ${{ runner.temp }}/old/$tail.txt ${{ runner.temp }}/new/$tail.txt
100+
if [ $? -ne 0 ]
101+
then
102+
resultcode=1
103+
fi
104+
echo old
105+
grep "my-dali-plane" ${{ runner.temp }}/old/$tail.txt | cat
106+
echo new
107+
grep "my-dali-plane" ${{ runner.temp }}/new/$tail.txt | cat
108+
done
109+
fi
110+
111+
exit $resultcode

testing/helm/tests/implicitplanes.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ storage:
1717
storageClass: ""
1818
forcePermissions: true
1919
category: sasha
20-
- name: my-dali-plane
20+
- name: my-dali-planexx
2121
prefix: "/var/lib/HPCCSystems/dalistorage"
2222
storageSize: 1Gi
2323
storageClass: ""

0 commit comments

Comments
 (0)