Skip to content

Commit d7882fd

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

File tree

2 files changed

+56
-7
lines changed

2 files changed

+56
-7
lines changed

.github/workflows/test-helm.yml

+55-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,57 @@ 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+
baseref=""
74+
if [[ ${{ github.event_name }} == 'pull_request' ]]
75+
then
76+
baseref=${{ github.base_ref }}
77+
else
78+
baseref="HEAD^"
79+
fi
80+
git fetch --no-tags --prune --progress --no-recurse-submodules --quiet --depth=1 origin $baseref
81+
echo git checkout $baseref
82+
git checkout $baseref
83+
84+
helm template helm/hpcc > ${{ runner.temp }}/old/output.txt
85+
for file in testing/helm/tests/*.yaml
86+
do
87+
tail=$(basename $file)
88+
helm template helm/hpcc --values $file > ${{ runner.temp }}/old/$tail.txt
89+
done
90+
91+
diff ${{ runner.temp }}/old/output.txt ${{ runner.temp }}/new/output.txt
92+
if [ $? -ne 0 ]
93+
then
94+
resultcode=1
95+
else
96+
#Only check for differences in the specialised test files if the default values file is the same
97+
for file in testing/helm/tests/*.yaml
98+
do
99+
tail=$(basename $file)
100+
echo Check $tail
101+
diff ${{ runner.temp }}/old/$tail.txt ${{ runner.temp }}/new/$tail.txt
102+
if [ $? -ne 0 ]
103+
then
104+
resultcode=1
105+
fi
106+
echo old
107+
grep "my-dali-plane" ${{ runner.temp }}/old/$tail.txt | cat
108+
echo new
109+
grep "my-dali-plane" ${{ runner.temp }}/new/$tail.txt | cat
110+
done
111+
fi
112+
113+
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)