1+
12name : Vertica CI
23
34on : [push, pull_request]
5556 helm repo add vertica-charts https://vertica.github.io/charts
5657 helm repo add bitnami https://charts.bitnami.com/bitnami || true
5758 helm repo update
58-
5959 # ---------------------------
6060 # MinIO Setup
6161 # ---------------------------
@@ -112,7 +112,6 @@ jobs:
112112 kubectl -n minio rollout status deployment/minio --timeout=2m
113113 kubectl get pods -n minio -o wide || true
114114 kubectl get svc -n minio || true
115-
116115 - name : Ensure MinIO bucket exists
117116 run : |
118117 kubectl run mc-client --rm -i --restart=Never \
@@ -123,7 +122,6 @@ jobs:
123122 mc mb --ignore-existing localminio/vertica-fleeting && \
124123 mc ls localminio
125124 "
126-
127125 - name : Create MinIO Secret
128126 run : |
129127 kubectl create ns my-verticadb-operator
@@ -133,7 +131,6 @@ jobs:
133131 --from-literal=accesskey="minioadmin" \
134132 --from-literal=secretkey="minioadmin"
135133 kubectl get secret communal-creds -n my-verticadb-operator -o yaml || true
136-
137134 # ---------------------------
138135 # Vertica Operator + DB Deployment
139136 # ---------------------------
@@ -151,7 +148,6 @@ jobs:
151148 helm upgrade --install vdb-op vertica-charts/verticadb-operator \
152149 -n my-verticadb-operator -f operator-values.yaml --wait --timeout 10m
153150 kubectl -n my-verticadb-operator get pods -o wide || true
154-
155151 - name : Deploy VerticaDB and per-node Services
156152 run : |
157153 cat <<'EOF' | kubectl apply -f -
@@ -160,8 +156,6 @@ jobs:
160156 metadata:
161157 name: verticadb-sample
162158 namespace: my-verticadb-operator
163- annotations:
164- vertica.com/k-safety: "0"
165159 spec:
166160 image: opentext/vertica-k8s:latest
167161 dbName: vdb
@@ -176,7 +170,7 @@ jobs:
176170 depotPath: /depot
177171 subclusters:
178172 - name: defaultsubcluster
179- size: 1
173+ size: 3
180174 ---
181175 # -------------------------------------
182176 # Per-node Services (needed for LB tests)
@@ -220,7 +214,6 @@ jobs:
220214 - port: 5433
221215 targetPort: 5433
222216 EOF
223-
224217 - name : Wait for Vertica readiness
225218 run : |
226219 NS=my-verticadb-operator
@@ -230,22 +223,17 @@ jobs:
230223 kubectl get pod ${POD} -n ${NS} && break || sleep 10
231224 done
232225 kubectl wait --for=condition=Ready pod/${POD} -n ${NS} --timeout=5m
233-
234226 echo "🚀 Creating test runner pod..."
235227 kubectl -n ${NS} run test-runner --image=python:3.13-slim --restart=Never --command -- sleep infinity
236228 kubectl -n ${NS} wait --for=condition=Ready pod/test-runner --timeout=180s
237-
238229 echo "🩹 Adding Vertica pod entries to /etc/hosts in test pod..."
239230 for p in $(kubectl -n $NS get pods -l app.kubernetes.io/instance=verticadb-sample -o jsonpath='{.items[*].metadata.name}'); do
240231 IP=$(kubectl -n $NS get pod $p -o jsonpath='{.status.podIP}')
241232 echo "$IP $p.$NS.svc.cluster.local $p" | kubectl -n $NS exec -i test-runner -- tee -a /etc/hosts >/dev/null
242233 echo "✔ Added $p -> $IP"
243234 done
244-
245235 echo "📂 Copying repository into pod..."
246236 kubectl -n ${NS} cp . test-runner:/workspace
247-
248-
249237 # ---------------------------
250238 # Keycloak + OAuth setup
251239 # ---------------------------
@@ -299,12 +287,10 @@ jobs:
299287 - port: 8080
300288 targetPort: 8080
301289 EOF
302-
303290 - name : Wait for Keycloak readiness
304291 run : |
305292 kubectl -n keycloak rollout status deploy/keycloak --timeout=2m
306293 kubectl -n keycloak get pods -o wide
307-
308294 - name : Configure Keycloak realm, client, and user
309295 run : |
310296 kubectl -n keycloak exec deploy/keycloak -- \
@@ -325,7 +311,6 @@ jobs:
325311 kubectl -n keycloak exec deploy/keycloak -- \
326312 /opt/keycloak/bin/kcadm.sh set-password -r test \
327313 --username oauth_user --new-password password
328-
329314 - name : Configure Vertica Authentication
330315 run : |
331316 NS=my-verticadb-operator
@@ -345,7 +330,6 @@ jobs:
345330 GRANT AUTHENTICATION v_dbadmin_hash TO dbadmin;
346331 \"
347332 "
348-
349333 # ---------------------------
350334 # Testing section
351335 # ---------------------------
@@ -356,18 +340,15 @@ jobs:
356340 SVC=verticadb-sample-defaultsubcluster
357341 LOCATOR="${SVC}.${NS}.svc.cluster.local:5433"
358342 POD=py-test-runner
359-
360343 # Decide image based on matrix value
361344 if [[ "${{ matrix.python-version }}" == pypy* ]]; then
362345 VERSION="${{ matrix.python-version }}" # "pypy3.10"
363346 IMAGE="pypy:${VERSION#pypy}" # "pypy:3.10"
364347 else
365348 IMAGE="python:${{ matrix.python-version }}"
366349 fi
367-
368350 echo "Ensuring namespace ${NS} exists..."
369351 kubectl get ns ${NS} >/dev/null 2>&1 || kubectl create ns ${NS}
370-
371352 echo "Waiting for Vertica service endpoints..."
372353 WAIT_TIMEOUT=300
373354 INTERVAL=5
@@ -377,19 +358,16 @@ jobs:
377358 -o jsonpath='{.subsets[*].addresses[*].ip}' 2>/dev/null || true)
378359 [ -n "$addrs" ] && break || sleep ${INTERVAL}
379360 done
380-
381361 if [ -z "$addrs" ]; then
382362 echo "Vertica service endpoints not found"
383363 kubectl -n ${NS} get pods -o wide || true
384364 kubectl -n ${NS} get endpoints ${SVC} -o yaml || true
385365 exit 1
386366 fi
387-
388367 echo "Retrieving access token from Keycloak with retries..."
389368 TOKEN=""
390369 for i in {1..10}; do
391370 echo "Attempt $i..."
392-
393371 RAW=$(
394372 kubectl -n keycloak run curl-client \
395373 --image=curlimages/curl:latest \
@@ -403,10 +381,8 @@ jobs:
403381 -d "grant_type=password" \
404382 -d "client_secret=${CLIENT_SECRET}"
405383 ) || true
406-
407384 # Keep only the last line (JSON), remove kubectl noise
408385 RAW=$(printf "%s" "$RAW" | sed -n '$p')
409-
410386 # Validate RAW is JSON
411387 # Validate JSON; do NOT exit — allow retry
412388 if ! printf '%s' "$RAW" | python3 -c 'import sys,json; json.load(sys.stdin)' >/dev/null 2>&1; then
@@ -416,28 +392,22 @@ jobs:
416392 # Extract token only if JSON is valid
417393 TOKEN=$(printf '%s' "$RAW" | python3 -c 'import sys,json; print(json.load(sys.stdin).get("access_token", ""))')
418394 fi
419-
420395 if [ -n "$TOKEN" ] && [ "$TOKEN" != "null" ]; then
421396 echo "Access token retrieved successfully."
422397 break
423398 fi
424-
425399 echo "Token fetch failed, Keycloak may not be ready yet."
426400 sleep 5
427-
428401 if [ "$i" -eq 10 ]; then
429402 echo "Failed to fetch access token after multiple retries."
430403 exit 1
431404 fi
432405 done
433-
434406 echo "Access token retrieved (length: ${#TOKEN})"
435-
436407 echo "Creating Kubernetes Secret with token..."
437408 kubectl -n ${NS} delete secret oauth-token --ignore-not-found
438409 kubectl -n ${NS} create secret generic oauth-token \
439410 --from-literal=access_token="$TOKEN"
440-
441411 echo "Creating Python test pod with secret mount..."
442412 kubectl -n ${NS} delete pod ${POD} --ignore-not-found || true
443413 cat <<EOF | kubectl apply -f -
@@ -471,19 +441,16 @@ jobs:
471441 - name: VP_TEST_PASSWORD
472442 value: ""
473443 EOF
474-
475444 echo "Waiting for test pod readiness..."
476445 if ! kubectl -n ${NS} wait --for=condition=Ready pod/${POD} --timeout=180s; then
477446 echo "Pod did not become Ready. Collecting debug info..."
478447 kubectl -n ${NS} describe pod ${POD} || true
479448 kubectl -n ${NS} logs ${POD} || true
480449 exit 1
481450 fi
482-
483451 echo "Copying repository into pod..."
484452 kubectl -n ${NS} exec -i ${POD} -- mkdir -p /workspace
485453 tar cf - . | kubectl -n ${NS} exec -i ${POD} -- tar xf - -C /workspace
486-
487454 echo "Installing dependencies..."
488455 kubectl -n ${NS} exec ${POD} -- bash -lc '
489456 set -e
@@ -505,72 +472,56 @@ jobs:
505472 fi
506473 which tox && tox --version
507474 '
508-
509475 echo "Running Python tests inside pod..."
510476 kubectl -n ${NS} exec -i ${POD} -- bash -lc "
511477 set -euo pipefail
512478 cd /workspace
513-
514479 echo 'Checking connectivity to Vertica...'
515480 nc -zv \${VP_TEST_HOST} \${VP_TEST_PORT} || { echo 'Cannot reach Vertica host'; exit 1; }
516-
517481 echo 'Vertica reachable; performing token introspection...'
518482 INTROSPECT_OUTPUT=\$(curl -s -X POST http://keycloak.keycloak.svc.cluster.local:8080/realms/test/protocol/openid-connect/token/introspect \
519483 -d 'client_id=${CLIENT_ID}' \
520484 -d 'client_secret=${CLIENT_SECRET}' \
521485 -d 'token='\${VP_TEST_OAUTH_ACCESS_TOKEN})
522-
523486 if echo \"\$INTROSPECT_OUTPUT\" | grep -q '\"active\":true'; then
524487 echo 'Token introspection successful (active=true)'
525488 else
526489 echo 'Token introspection failed:'; echo \"\$INTROSPECT_OUTPUT\"; exit 1
527490 fi
528-
529491 if command -v pypy3 >/dev/null 2>&1; then
530492 export PATH=\$PATH:/opt/pypy/bin
531493 fi
532-
533494 echo 'Running pytest suite via tox...'
534495 tox -e py
535496 "
536-
537497 echo "Cleaning up test pod..."
538498 kubectl -n ${NS} delete pod ${POD} --ignore-not-found || true
539-
540499 # ---------------------------
541500 # Final Teardown (K8s + KinD)
542501 # ---------------------------
543502 - name : Cleanup Kubernetes resources
544503 if : always()
545504 run : |
546505 echo "Starting cleanup..."
547-
548506 echo "Deleting Python test runner pods..."
549507 kubectl -n my-verticadb-operator delete pod test-runner --ignore-not-found || true
550508 kubectl -n my-verticadb-operator delete pod py-test-runner --ignore-not-found || true
551-
552509 echo "Deleting Keycloak pods & services..."
553510 kubectl delete deployment keycloak -n keycloak --ignore-not-found || true
554511 kubectl delete service keycloak -n keycloak --ignore-not-found || true
555512 kubectl delete ns keycloak --ignore-not-found || true
556-
557513 echo "Deleting VerticaDB and Operator..."
558514 kubectl delete verticadb verticadb-sample -n my-verticadb-operator --ignore-not-found || true
559515 helm uninstall vdb-op -n my-verticadb-operator || true
560516 kubectl delete ns my-verticadb-operator --ignore-not-found || true
561-
562517 echo "Deleting MinIO..."
563518 kubectl delete -f minio.yaml --ignore-not-found || true
564519 kubectl delete ns minio --ignore-not-found || true
565-
566520 echo "Deleting leftover services..."
567521 kubectl delete svc vertica-node-0 -n my-verticadb-operator --ignore-not-found || true
568522 kubectl delete svc vertica-node-1 -n my-verticadb-operator --ignore-not-found || true
569523 kubectl delete svc vertica-node-2 -n my-verticadb-operator --ignore-not-found || true
570-
571524 echo "Kubernetes resources cleanup done."
572-
573-
574525 - name : Delete KinD cluster
575526 if : always()
576527 run : |
0 commit comments