Skip to content

Commit b4efe7a

Browse files
committed
Removed jq usage and started using Github secrets
1 parent fd32225 commit b4efe7a

File tree

1 file changed

+19
-10
lines changed

1 file changed

+19
-10
lines changed

.github/workflows/ci.yaml

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ jobs:
151151
helm upgrade --install vdb-op vertica-charts/verticadb-operator \
152152
-n my-verticadb-operator -f operator-values.yaml --wait --timeout 10m
153153
kubectl -n my-verticadb-operator get pods -o wide || true
154+
154155
- name: Deploy VerticaDB and per-node Services
155156
run: |
156157
cat <<'EOF' | kubectl apply -f -
@@ -179,6 +180,9 @@ jobs:
179180
---
180181
# -------------------------------------
181182
# Per-node Services (needed for LB tests)
183+
# Note: node-1 and node-2 pods don't exist yet because subcluster size=1.
184+
# These Services are intentional placeholders used when we scale the cluster
185+
# for load-balancing and failover tests. Kubernetes allows zero-endpoint Services.
182186
# -------------------------------------
183187
apiVersion: v1
184188
kind: Service
@@ -311,8 +315,8 @@ jobs:
311315
/opt/keycloak/bin/kcadm.sh create realms -s realm=test -s enabled=true
312316
kubectl -n keycloak exec deploy/keycloak -- \
313317
/opt/keycloak/bin/kcadm.sh create clients -r test \
314-
-s clientId=vertica -s enabled=true \
315-
-s secret=P9f8350QQIUhFfK1GF5sMhq4Dm3P6Sbs \
318+
-s clientId="${CLIENT_ID}" -s enabled=true \
319+
-s secret="${CLIENT_SECRET}"' \
316320
-s 'redirectUris=["*"]' \
317321
-s directAccessGrantsEnabled=true
318322
kubectl -n keycloak exec deploy/keycloak -- \
@@ -329,8 +333,8 @@ jobs:
329333
kubectl -n ${NS} exec ${POD} -c server -- bash -c "
330334
/opt/vertica/bin/vsql -U dbadmin -c \"
331335
CREATE AUTHENTICATION v_oauth METHOD 'oauth' HOST '0.0.0.0/0';
332-
ALTER AUTHENTICATION v_oauth SET client_id = 'vertica';
333-
ALTER AUTHENTICATION v_oauth SET client_secret = 'P9f8350QQIUhFfK1GF5sMhq4Dm3P6Sbs';
336+
ALTER AUTHENTICATION v_oauth SET client_id = '${CLIENT_ID}';
337+
ALTER AUTHENTICATION v_oauth SET client_secret = '${CLIENT_SECRET}';
334338
ALTER AUTHENTICATION v_oauth SET discovery_url = 'http://keycloak.keycloak.svc.cluster.local:8080/realms/test/.well-known/openid-configuration';
335339
ALTER AUTHENTICATION v_oauth SET introspect_url = 'http://keycloak.keycloak.svc.cluster.local:8080/realms/test/protocol/openid-connect/token/introspect';
336340
CREATE USER oauth_user;
@@ -400,17 +404,22 @@ jobs:
400404
-d "client_secret=${CLIENT_SECRET}"
401405
) || true
402406
403-
# JSON validity check
404-
if echo "$RAW" | jq -e . >/dev/null 2>&1; then
405-
TOKEN=$(echo "$RAW" | jq -r .access_token)
407+
# Validate RAW is JSON
408+
if ! printf '%s' "$RAW" | python3 -c 'import sys,json; json.load(sys.stdin)' >/dev/null 2>&1; then
409+
echo "Token endpoint did not return valid JSON:"
410+
printf '%s\n' "$RAW"
411+
exit 1
406412
fi
407413
408-
if [ -n "${TOKEN}" ] && [ "${TOKEN}" != "null" ]; then
414+
# Extract token (without printing it)
415+
TOKEN=$(printf '%s' "$RAW" | python3 -c 'import sys,json; print(json.load(sys.stdin).get("access_token", ""))')
416+
417+
if [ -n "$TOKEN" ] && [ "$TOKEN" != "null" ]; then
409418
echo "Access token retrieved successfully."
410419
break
411420
fi
412421
413-
echo "Token fetch failed: $RAW"
422+
echo "Token fetch failed, Keycloak may not be ready yet."
414423
sleep 5
415424
416425
if [ "$i" -eq 10 ]; then
@@ -504,7 +513,7 @@ jobs:
504513
505514
echo 'Vertica reachable; performing token introspection...'
506515
INTROSPECT_OUTPUT=\$(curl -s -X POST http://keycloak.keycloak.svc.cluster.local:8080/realms/test/protocol/openid-connect/token/introspect \
507-
-d 'client_id=vertica' \
516+
-d 'client_id=${CLIENT_ID}' \
508517
-d 'client_secret=${CLIENT_SECRET}' \
509518
-d 'token='\${VP_TEST_OAUTH_ACCESS_TOKEN})
510519

0 commit comments

Comments
 (0)