Skip to content

Commit bcac6ef

Browse files
committed
Add Helm smoke test workflow
- Introduce a GitHub Actions workflow for DevLake Helm chart smoke testing. - Set up a temporary Kubernetes cluster with kind, install the Helm chart, and verify core services. - Incorporate health checks for Grafana and connected MySQL datasource. - Provide detailed diagnostics on failure to assist troubleshooting. Signed-off-by: kahirokunn <okinakahiro@gmail.com>
1 parent d81a0ae commit bcac6ef

1 file changed

Lines changed: 97 additions & 0 deletions

File tree

.github/workflows/smoke-test.yml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: DevLake Helm Smoke Test
2+
3+
on:
4+
push:
5+
branches: [ "**" ]
6+
pull_request:
7+
branches: [ "**" ]
8+
9+
jobs:
10+
smoke-test:
11+
name: Smoke Test
12+
runs-on: ubuntu-latest
13+
timeout-minutes: 45
14+
env:
15+
RELEASE_NAME: devlake
16+
NAMESPACE: devlake
17+
GRAFANA_ADMIN_PASSWORD: admin
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v5
21+
22+
- name: Set up Helm
23+
uses: azure/setup-helm@v4
24+
25+
- name: Create kind cluster
26+
uses: helm/kind-action@v1.12.0
27+
with:
28+
cluster_name: devlake-e2e
29+
30+
- name: Set up kubectl
31+
uses: azure/setup-kubectl@v4
32+
33+
- name: Build chart dependencies (local)
34+
run: |
35+
helm dependency build charts/devlake
36+
37+
- name: Install DevLake chart (with Grafana)
38+
run: |
39+
ENCRYPTION_SECRET=$(openssl rand -base64 2000 | tr -dc 'A-Z' | fold -w 128 | head -n 1)
40+
set -euo pipefail
41+
helm install "$RELEASE_NAME" ./charts/devlake \
42+
--namespace "$NAMESPACE" \
43+
--create-namespace \
44+
--wait \
45+
--timeout 25m \
46+
--set lake.encryptionSecret.secret="${ENCRYPTION_SECRET}" \
47+
--set grafana.adminPassword="${GRAFANA_ADMIN_PASSWORD}"
48+
49+
- name: Verify Grafana health and MySQL datasource connectivity
50+
run: |
51+
set -euo pipefail
52+
# Port-forward Grafana service locally
53+
kubectl port-forward -n "$NAMESPACE" svc/${RELEASE_NAME}-grafana 3000:80 >/tmp/pf.log 2>&1 &
54+
# Wait for port-forward to come up
55+
for i in {1..60}; do
56+
if curl -sSf -o /dev/null http://127.0.0.1:3000/api/health; then
57+
break
58+
fi
59+
sleep 2
60+
done
61+
# Basic health
62+
curl -sSf http://127.0.0.1:3000/api/health | tee /tmp/grafana_health.json
63+
# List datasources and find a MySQL datasource id
64+
# Requires admin credentials set via helm values
65+
DS_ID=$(curl -sSf -u admin:"${GRAFANA_ADMIN_PASSWORD}" http://127.0.0.1:3000/api/datasources \
66+
| jq -r '[.[] | select(.type=="mysql")][0].id // empty')
67+
if [ -z "${DS_ID}" ]; then
68+
echo "ERROR: No MySQL datasource found in Grafana" >&2
69+
exit 2
70+
fi
71+
echo "Found MySQL datasource id=${DS_ID}"
72+
# Check datasource health
73+
HEALTH_JSON=$(curl -sSf -u admin:"${GRAFANA_ADMIN_PASSWORD}" http://127.0.0.1:3000/api/datasources/${DS_ID}/health)
74+
echo "$HEALTH_JSON" | tee /tmp/grafana_ds_health.json
75+
echo "$HEALTH_JSON" | grep -q '"status":"OK"'
76+
77+
- name: Dump diagnostics on failure
78+
if: failure()
79+
run: |
80+
echo "===== Helm list ====="
81+
helm list -n "$NAMESPACE" || true
82+
echo "===== Helm status ====="
83+
helm status "$RELEASE_NAME" -n "$NAMESPACE" || true
84+
echo "===== Kubernetes objects ====="
85+
kubectl get all -n "$NAMESPACE" || true
86+
echo "===== Describe MySQL ====="
87+
kubectl describe statefulset/${RELEASE_NAME}-mysql -n "$NAMESPACE" || true
88+
kubectl logs statefulset/${RELEASE_NAME}-mysql -n "$NAMESPACE" --all-containers --tail=200 || true
89+
echo "===== Describe Lake ====="
90+
kubectl describe deploy/${RELEASE_NAME}-lake -n "$NAMESPACE" || true
91+
kubectl logs deploy/${RELEASE_NAME}-lake -n "$NAMESPACE" --all-containers --tail=200 || true
92+
echo "===== Describe UI ====="
93+
kubectl describe deploy/${RELEASE_NAME}-ui -n "$NAMESPACE" || true
94+
kubectl logs deploy/${RELEASE_NAME}-ui -n "$NAMESPACE" --all-containers --tail=200 || true
95+
echo "===== Describe Grafana ====="
96+
kubectl describe deploy/${RELEASE_NAME}-grafana -n "$NAMESPACE" || true
97+
kubectl logs deploy/${RELEASE_NAME}-grafana -n "$NAMESPACE" --all-containers --tail=200 || true

0 commit comments

Comments
 (0)