-
Notifications
You must be signed in to change notification settings - Fork 1
211 lines (178 loc) · 7.61 KB
/
Copy pathtest-provisioning-e2e.yaml
File metadata and controls
211 lines (178 loc) · 7.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
name: CI Provisioning E2E (Knative)
on:
pull_request:
branches:
- main
- develop
- release/*
paths:
- "packages/provisioning-handlers/**"
- "tests/e2e/__tests__/provisioning-knative*"
- "tests/e2e/fixtures/provisioning-knative*"
- ".github/workflows/test-provisioning-e2e.yaml"
push:
branches:
- main
- develop
- release/*
- feat/provisioning-handlers
paths:
- "packages/provisioning-handlers/**"
- "tests/e2e/__tests__/provisioning-knative*"
- "tests/e2e/fixtures/provisioning-knative*"
- ".github/workflows/test-provisioning-e2e.yaml"
workflow_dispatch: {}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
e2e-knative:
name: Provisioning E2E (Knative + kind)
runs-on: ubuntu-latest
timeout-minutes: 25
# ── PostgreSQL service container ──────────────────────────────────────
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: provisioning_e2e
ports:
- 5432:5432
options: >-
--health-cmd="pg_isready -U postgres"
--health-interval=5s
--health-timeout=5s
--health-retries=10
steps:
- name: Checkout
uses: actions/checkout@v5
# ── Node / pnpm ────────────────────────────────────────────────────
- name: Setup pnpm
uses: pnpm/action-setup@v6
- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: "22"
cache: "pnpm"
- name: Generate function packages
run: node --experimental-strip-types scripts/generate.ts
- name: Install dependencies
run: pnpm install
- name: Build workspace
run: pnpm build
# ── kind cluster ───────────────────────────────────────────────────
- name: Setup kind cluster
uses: helm/kind-action@v1
with:
cluster_name: provisioning-e2e
wait: 120s
- name: Verify cluster
run: |
kubectl version
kubectl get nodes -o wide
# ── Knative Serving ────────────────────────────────────────────────
- name: Install Knative Serving CRDs
run: |
KNATIVE_VERSION=v1.20.0
echo "Installing Knative Serving ${KNATIVE_VERSION} CRDs..."
kubectl apply -f "https://github.com/knative/serving/releases/download/knative-${KNATIVE_VERSION}/serving-crds.yaml"
- name: Install Knative Serving core
run: |
KNATIVE_VERSION=v1.20.0
echo "Installing Knative Serving ${KNATIVE_VERSION} core..."
kubectl apply -f "https://github.com/knative/serving/releases/download/knative-${KNATIVE_VERSION}/serving-core.yaml"
- name: Install Kourier networking
run: |
KNATIVE_VERSION=v1.20.0
echo "Installing Kourier networking layer..."
kubectl apply -f "https://github.com/knative/net-kourier/releases/download/knative-${KNATIVE_VERSION}/kourier.yaml"
kubectl patch configmap/config-network \
--namespace knative-serving \
--type merge \
--patch '{"data":{"ingress-class":"kourier.ingress.networking.knative.dev"}}'
- name: Wait for Knative Serving pods
run: |
echo "Waiting for Knative Serving pods..."
kubectl wait --for=condition=Available deployment --all \
-n knative-serving --timeout=180s || true
echo "=== Knative Serving pods ==="
kubectl get pods -n knative-serving
echo "=== Kourier pods ==="
kubectl get pods -n kourier-system || true
- name: Verify Knative CRDs
run: |
echo "Checking for serving.knative.dev CRDs..."
kubectl get crd | grep knative || { echo "No Knative CRDs!"; exit 1; }
# ── Bootstrap DB ───────────────────────────────────────────────────
- name: Bootstrap minimal DB for provisioning
env:
PGHOST: localhost
PGPORT: "5432"
PGUSER: postgres
PGPASSWORD: postgres
PGDATABASE: provisioning_e2e
run: |
psql -f tests/e2e/fixtures/provisioning-knative-bootstrap.sql
echo "DB bootstrap complete."
echo "=== Verify seed data ==="
psql -c "SELECT name FROM metaschema_public.namespace;"
psql -c "SELECT name, image FROM constructive_compute_public.platform_function_definitions;"
# ── Start kubectl proxy ─────────────────────────────────────────────
- name: Start kubectl proxy
run: |
kubectl proxy --port=8001 &
echo "kubectl proxy started on :8001"
sleep 2
# ── Run E2E tests ──────────────────────────────────────────────────
- name: Run provisioning Knative E2E tests
env:
K8S_API_URL: http://localhost:8001
PGHOST: localhost
PGPORT: "5432"
PGUSER: postgres
PGPASSWORD: postgres
PGDATABASE: provisioning_e2e
run: |
pnpm jest \
tests/e2e/__tests__/provisioning-knative-e2e.test.ts \
--no-coverage \
--testTimeout=360000
# ── Diagnostics on failure ─────────────────────────────────────────
- name: Dump diagnostics on failure
if: failure()
run: |
echo "=== Namespaces ==="
kubectl get ns || true
echo ""
echo "=== Knative Services (all namespaces) ==="
kubectl get ksvc -A || true
echo ""
echo "=== Pods in test-ns ==="
kubectl get pods -n test-ns -o wide || true
echo ""
echo "=== Describe ksvc in test-ns ==="
kubectl describe ksvc -n test-ns || true
echo ""
echo "=== Events in test-ns ==="
kubectl get events -n test-ns --sort-by='.lastTimestamp' || true
echo ""
echo "=== Knative Serving pods ==="
kubectl get pods -n knative-serving -o wide || true
echo ""
echo "=== Kourier pods ==="
kubectl get pods -n kourier-system -o wide || true
echo ""
echo "=== Pod logs in test-ns ==="
for pod in $(kubectl get pods -n test-ns -o jsonpath='{.items[*].metadata.name}' 2>/dev/null); do
echo "--- $pod ---"
kubectl logs -n test-ns "$pod" --all-containers --tail=100 || true
done
echo ""
echo "=== Secrets in test-ns ==="
kubectl get secrets -n test-ns || true
echo ""
echo "=== DB function definitions ==="
PGHOST=localhost PGPORT=5432 PGUSER=postgres PGPASSWORD=postgres PGDATABASE=provisioning_e2e \
psql -c "SELECT id, name, service_url, image FROM constructive_compute_public.platform_function_definitions;" || true