Skip to content

Commit 284e0b7

Browse files
committed
github: Lint and test the helm chart.
1 parent d925abc commit 284e0b7

File tree

2 files changed

+133
-0
lines changed

2 files changed

+133
-0
lines changed

.github/workflows/dockerfile.yaml

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,105 @@ jobs:
4343
tags: ghcr.io/${{ github.repository }}:pr-${{ github.event.pull_request.number }}
4444
cache-from: type=gha
4545
cache-to: type=gha,mode=max
46+
47+
helm-docs:
48+
runs-on: ubuntu-latest
49+
steps:
50+
- name: Checkout
51+
uses: actions/checkout@v5
52+
53+
- name: Run helm-docs
54+
uses: losisin/helm-docs-github-action@v1
55+
with:
56+
fail-on-diff: true
57+
58+
helm-test:
59+
runs-on: ubuntu-latest
60+
needs:
61+
- helm-docs
62+
- build
63+
steps:
64+
- name: Checkout
65+
uses: actions/checkout@v5
66+
with:
67+
fetch-depth: 0
68+
69+
- name: Set up Helm
70+
uses: azure/setup-helm@v4.2.0
71+
with:
72+
version: v3.17.0
73+
74+
- uses: actions/setup-python@v5.3.0
75+
with:
76+
python-version: "3.x"
77+
check-latest: true
78+
79+
- name: Set up chart-testing
80+
uses: helm/chart-testing-action@v2.7.0
81+
with:
82+
version: 3.14.0
83+
yamllint_version: 1.37.1
84+
yamale_version: 6.0.0
85+
86+
- name: Set up helm repos
87+
run: |
88+
helm repo add groundhog2k https://groundhog2k.github.io/helm-charts/
89+
90+
- name: Run chart-testing (list-changed)
91+
id: list-changed
92+
run: |
93+
changed=$(ct list-changed --chart-dirs kubernetes/chart \
94+
--target-branch ${{ github.event.repository.default_branch }})
95+
if [[ -n "$changed" ]]; then
96+
echo "changed=true" >> "$GITHUB_OUTPUT"
97+
fi
98+
99+
- name: Run chart-testing (lint)
100+
if: steps.list-changed.outputs.changed == 'true'
101+
run: |
102+
ct lint --github-groups \
103+
--chart-dirs kubernetes/chart \
104+
--target-branch ${{ github.event.repository.default_branch }} \
105+
--lint-conf lintconf.yaml
106+
107+
- name: Create kind cluster
108+
if: steps.list-changed.outputs.changed == 'true'
109+
uses: helm/kind-action@v1
110+
111+
- name: Log in to GHCR
112+
if: steps.list-changed.outputs.changed == 'true'
113+
uses: docker/login-action@v3
114+
with:
115+
registry: ghcr.io
116+
username: ${{ github.actor }}
117+
password: ${{ secrets.GITHUB_TOKEN }}
118+
119+
- name: Load image into kind
120+
if: steps.list-changed.outputs.changed == 'true'
121+
run: |
122+
docker pull ghcr.io/${{ github.repository }}:pr-${{ github.event.pull_request.number }}
123+
kind load docker-image ghcr.io/${{ github.repository }}:pr-${{ github.event.pull_request.number }} --name chart-testing
124+
125+
- name: Run chart-testing (install)
126+
id: chart-testing-install
127+
if: steps.list-changed.outputs.changed == 'true'
128+
run: |
129+
ct install --github-groups \
130+
--chart-dirs kubernetes/chart \
131+
--target-branch ${{ github.event.repository.default_branch }} \
132+
--helm-extra-set-args "--values ./kubernetes/chart/zulip/ci/simple-values.yaml \
133+
--set image.tag=pr-${{ github.event.pull_request.number }}" \
134+
--skip-clean-up
135+
136+
- name: Fetch logs
137+
if: always()
138+
run: |
139+
namespace=$(helm list --all-namespaces --output json \
140+
| jq -r '[.[] | select(.namespace | startswith("zulip-"))][0].namespace')
141+
kubectl get pods -n "$namespace"
142+
for pod in $(kubectl get pods -n "$namespace" -o name); do
143+
kubectl describe "$pod" -n "$namespace"
144+
done
145+
pod=$(kubectl get pods -n "$namespace" -l app.kubernetes.io/name=zulip --output name)
146+
kubectl -n "$namespace" logs "$pod"
147+
kubectl -n "$namespace" exec "$pod" -c zulip -- cat /var/log/zulip/errors.log
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
image:
3+
repository: ghcr.io/zulip/docker-zulip
4+
pullPolicy: Never
5+
# CI will pass tag: of the PR
6+
7+
zulip:
8+
password: set-secure-zulip-password
9+
environment:
10+
SETTING_ZULIP_ADMINISTRATOR: "admin@example.net"
11+
SETTING_EXTERNAL_HOST: zulip.example.net
12+
ZULIP_AUTH_BACKENDS: "EmailAuthBackend"
13+
14+
memcached:
15+
memcachedPassword: set-secure-memcached-password
16+
17+
rabbitmq:
18+
auth:
19+
password: set-secure-rabbitmq-password
20+
erlangCookie: set-secure-cookie-password
21+
22+
redis:
23+
auth:
24+
password: set-secure-redis-password
25+
26+
postgresql:
27+
auth:
28+
# # postgres admin user password
29+
postgresqlPassword: set-secure-pg-postgres-password
30+
# # postgres zulip user password
31+
password: set-secure-pg-zulip-password

0 commit comments

Comments
 (0)