Skip to content

Commit 2e0aed0

Browse files
committed
ci: add kind e2e gate for Backstage
Add an e2e workflow that proves the deployment manifests actually boot Backstage. On pull_request and push to main it builds the backend image, loads it into a kind cluster, applies config/test, waits for the postgres and backstage rollouts, and asserts the readiness, liveness, and catalog API endpoints all return HTTP 200. Key changes: - Build with docker/build-push-action and GitHub Actions layer caching (cache-from/cache-to type=gha) so the expensive yarn install / tsc / build:backend layers are reused across PR runs. - Dump pods, deployment description, and backend logs on failure. Claude-Session: https://claude.ai/code/session_01NMSkwUcaTmZr7S5XmV2aFG
1 parent d353774 commit 2e0aed0

1 file changed

Lines changed: 76 additions & 0 deletions

File tree

.github/workflows/e2e.yaml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: E2E
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
9+
jobs:
10+
kind-e2e:
11+
runs-on: ubuntu-latest
12+
env:
13+
CLUSTER_NAME: backstage-e2e
14+
IMAGE: backstage:e2e
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
19+
- name: Set up Docker Buildx
20+
uses: docker/setup-buildx-action@v3
21+
22+
- name: Build backend image
23+
uses: docker/build-push-action@v6
24+
with:
25+
context: .
26+
file: packages/backend/Dockerfile
27+
load: true
28+
tags: ${{ env.IMAGE }}
29+
cache-from: type=gha
30+
cache-to: type=gha,mode=max
31+
32+
- name: Create kind cluster
33+
uses: helm/kind-action@v1
34+
with:
35+
cluster_name: ${{ env.CLUSTER_NAME }}
36+
37+
- name: Load image into kind
38+
run: kind load docker-image "${IMAGE}" --name "${CLUSTER_NAME}"
39+
40+
- name: Deploy test overlay
41+
run: kustomize build config/test | kubectl apply -f -
42+
43+
- name: Wait for PostgreSQL
44+
run: kubectl -n backstage rollout status deploy/postgres --timeout=5m
45+
46+
- name: Wait for Backstage
47+
run: kubectl -n backstage rollout status deploy/backstage --timeout=10m
48+
49+
- name: Smoke test backend
50+
run: |
51+
kubectl -n backstage run curl-smoke \
52+
--image=curlimages/curl:8.10.1 \
53+
--restart=Never --rm -i --quiet -- \
54+
sh -ceu '
55+
echo "readiness:"
56+
code=$(curl -sS -o /dev/null -w "%{http_code}" http://backstage:7007/.backstage/health/v1/readiness)
57+
echo "$code"
58+
[ "$code" = "200" ]
59+
60+
echo "liveness:"
61+
code=$(curl -sS -o /dev/null -w "%{http_code}" http://backstage:7007/.backstage/health/v1/liveness)
62+
echo "$code"
63+
[ "$code" = "200" ]
64+
65+
echo "catalog entities:"
66+
code=$(curl -sS -o /dev/null -w "%{http_code}" http://backstage:7007/api/catalog/entities)
67+
echo "$code"
68+
[ "$code" = "200" ]
69+
'
70+
71+
- name: Dump diagnostics
72+
if: failure()
73+
run: |
74+
kubectl -n backstage get pods,svc
75+
kubectl -n backstage describe deploy/backstage
76+
kubectl -n backstage logs deploy/backstage --all-containers --tail=200 || true

0 commit comments

Comments
 (0)