Skip to content

Commit b2858f5

Browse files
committed
github: Lint and test the helm chart.
1 parent 3d1b26f commit b2858f5

File tree

1 file changed

+93
-0
lines changed

1 file changed

+93
-0
lines changed

.github/workflows/dockerfile.yaml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,96 @@ jobs:
4040
tags: ghcr.io/${{ github.repository }}:pr-${{ github.event.pull_request.number }}
4141
cache-from: type=gha
4242
cache-to: type=gha,mode=max
43+
44+
helm-docs:
45+
runs-on: ubuntu-latest
46+
steps:
47+
- name: Checkout
48+
uses: actions/checkout@v5
49+
50+
- name: Run helm-docs
51+
uses: losisin/helm-docs-github-action@v1
52+
with:
53+
fail-on-diff: true
54+
55+
helm-test:
56+
runs-on: ubuntu-latest
57+
needs:
58+
- helm-docs
59+
- build
60+
steps:
61+
- name: Checkout
62+
uses: actions/checkout@v5
63+
with:
64+
fetch-depth: 0
65+
66+
- name: Set up Helm
67+
uses: azure/[email protected]
68+
with:
69+
version: v3.17.0
70+
71+
- uses: actions/[email protected]
72+
with:
73+
python-version: "3.x"
74+
check-latest: true
75+
76+
- name: Set up chart-testing
77+
uses: helm/[email protected]
78+
with:
79+
version: 3.14.0
80+
yamllint_version: 1.37.1
81+
yamale_version: 6.0.0
82+
83+
- name: Set up helm repos
84+
run: |
85+
helm repo add groundhog2k https://groundhog2k.github.io/helm-charts/
86+
87+
- name: Run chart-testing (list-changed)
88+
id: list-changed
89+
run: |
90+
changed=$(ct list-changed --chart-dirs kubernetes/chart \
91+
--target-branch ${{ github.event.repository.default_branch }})
92+
if [[ -n "$changed" ]]; then
93+
echo "changed=true" >> "$GITHUB_OUTPUT"
94+
fi
95+
96+
- name: Run chart-testing (lint)
97+
if: steps.list-changed.outputs.changed == 'true'
98+
run: |
99+
ct lint --github-groups \
100+
--chart-dirs kubernetes/chart \
101+
--target-branch ${{ github.event.repository.default_branch }} \
102+
--lint-conf lintconf.yaml
103+
104+
- name: Create kind cluster
105+
if: steps.list-changed.outputs.changed == 'true'
106+
uses: helm/kind-action@v1
107+
108+
- name: Load image into kind
109+
run: |
110+
docker pull ghcr.io/${{ github.repository }}:pr-${{ github.event.pull_request.number }}
111+
kind load docker-image ghcr.io/${{ github.repository }}:pr-${{ github.event.pull_request.number }}
112+
113+
- name: Run chart-testing (install)
114+
id: chart-testing-install
115+
if: steps.list-changed.outputs.changed == 'true'
116+
run: |
117+
ct install --github-groups \
118+
--chart-dirs kubernetes/chart \
119+
--target-branch ${{ github.event.repository.default_branch }} \
120+
--helm-extra-set-args "--set image.repository=ghcr.io/${{ github.repository }} \
121+
--set image.tag=pr-${{ inputs.pr-number }} \
122+
--set image.pullPolicy=Never" \
123+
--skip-clean-up
124+
125+
- name: Fetch logs
126+
if: always()
127+
run: |
128+
namespace=$(helm list --all-namespaces --output json \
129+
| jq -r '[.[] | select(.namespace | startswith("zulip-"))][0].namespace')
130+
pod=$(kubectl get pods -n "$namespace" -l app.kubernetes.io/name=zulip --output name)
131+
kubectl get pods -n "$namespace"
132+
for pod in $(kubectl get pods -n "$namespace" -o name); do
133+
kubectl describe "$pod" -n "$namespace"
134+
done
135+
kubectl -n "$namespace" exec -it "$pod" -c zulip -- cat /var/log/zulip/errors.log

0 commit comments

Comments
 (0)