Repository navigation
379 lines (358 loc) · 14.6 KB
/
Copy pathci.yaml
File metadata and controls
379 lines (358 loc) · 14.6 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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
name: CI
on:
pull_request:
branches:
- master
jobs:
# ---------------------------------------------------------------------------
# Lightweight build + smoke-import across all supported Python versions.
# Reliable and visible per-version (does not need a live Vertica server).
# ---------------------------------------------------------------------------
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- name: Installing graphviz package
run: sudo apt-get update && sudo apt-get install -y graphviz
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install package and smoke-import (no live DB)
run: |
python -m pip install --upgrade pip
# verticapy imports IPython at top level (sql_magic), so it is needed
# for the import smoke test even though it is not in install_requires.
pip install . ipython
python -c "import verticapy; print('verticapy', verticapy.__version__)"
# ---------------------------------------------------------------------------
# Determine whether a Vertica license is available. The VerticaDB operator
# requires a non-empty licenseSecret, and secrets are not exposed to fork PRs,
# so the integration job below only runs when VERTICA_LICENSE is present.
# ---------------------------------------------------------------------------
license-check:
runs-on: ubuntu-latest
outputs:
run_licensed: ${{ steps.check.outputs.run_licensed }}
steps:
- name: Check Vertica license availability
id: check
env:
VERTICA_LICENSE: ${{ secrets.VERTICA_LICENSE }}
run: |
if [ -z "${VERTICA_LICENSE:-}" ]; then
echo "::notice::VERTICA_LICENSE is unavailable (e.g. fork PR). Skipping the Vertica integration tests."
echo "run_licensed=false" >> "$GITHUB_OUTPUT"
else
echo "run_licensed=true" >> "$GITHUB_OUTPUT"
fi
# ---------------------------------------------------------------------------
# Full integration tests against a real Vertica deployed via the VerticaDB
# operator on KinD. Runs on a single Python version because the bring-up is
# heavy, and only when a license is available (the operator requires one).
# Marked non-blocking (continue-on-error) while the hosted-runner integration
# is being stabilized -- remove `continue-on-error` once it is consistently
# green so the tests gate merges again.
# ---------------------------------------------------------------------------
integration-tests:
needs: license-check
if: needs.license-check.outputs.run_licensed == 'true'
runs-on: ubuntu-latest
continue-on-error: true
steps:
# ---------------------------
# Checkout and setup
# ---------------------------
- name: Installing graphviz package
run: sudo apt-get update && sudo apt-get install -y graphviz
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
# ---------------------------
# Kubernetes (KinD) + Helm setup
# The standalone opentext/vertica-ce image was removed from Docker Hub,
# so we bring up Vertica via the VerticaDB operator on KinD (same approach
# as vertica/vertica-python).
# ---------------------------
- name: Set up Kubernetes (KinD)
uses: helm/kind-action@v1.8.0
with:
cluster_name: vertica-ci
node_image: kindest/node:v1.29.0
- name: Set up Helm
uses: azure/setup-helm@v3
with:
version: "3.11.3"
- name: Add Helm repositories
run: |
helm repo add vertica-charts https://vertica.github.io/charts
helm repo add bitnami https://charts.bitnami.com/bitnami || true
helm repo update
# ---------------------------
# MinIO (communal storage required by the operator)
# ---------------------------
- name: Install MinIO
run: |
kubectl create ns minio
cat <<'EOF' > minio.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: minio
namespace: minio
spec:
replicas: 1
selector:
matchLabels:
app: minio
template:
metadata:
labels:
app: minio
spec:
containers:
- name: minio
# minio/minio is no longer pullable from Docker Hub; use a pinned archived build.
image: bitnamilegacy/minio:2025.7.23
env:
- name: MINIO_ROOT_USER
value: "minioadmin"
- name: MINIO_ROOT_PASSWORD
value: "minioadmin"
ports:
- containerPort: 9000
volumeMounts:
- name: data
mountPath: /bitnami/minio/data
volumes:
- name: data
emptyDir: {}
---
apiVersion: v1
kind: Service
metadata:
name: minio
namespace: minio
spec:
selector:
app: minio
ports:
- port: 9000
targetPort: 9000
EOF
kubectl apply -f minio.yaml
if ! kubectl -n minio rollout status deployment/minio --timeout=5m; then
echo "::error::MinIO deployment did not become available. Dumping diagnostics."
kubectl -n minio get pods -o wide || true
kubectl -n minio describe pods -l app=minio || true
kubectl -n minio logs -l app=minio --tail=100 || true
exit 1
fi
kubectl get pods -n minio -o wide || true
kubectl get svc -n minio || true
- name: Ensure MinIO bucket exists
run: |
kubectl run mc-client --rm -i --restart=Never \
--image=bitnamilegacy/minio-client:2025.7.21 \
-n minio \
--command -- bash -c "
mc alias set localminio http://minio.minio.svc.cluster.local:9000 minioadmin minioadmin && \
mc mb --ignore-existing localminio/vertica-fleeting && \
mc ls localminio
"
- name: Create MinIO Secret
run: |
kubectl create ns my-verticadb-operator
kubectl delete secret communal-creds -n my-verticadb-operator --ignore-not-found
kubectl create secret generic communal-creds \
-n my-verticadb-operator \
--from-literal=accesskey="minioadmin" \
--from-literal=secretkey="minioadmin"
# ---------------------------
# Vertica license (this job only runs when VERTICA_LICENSE is available)
# ---------------------------
- name: Create Vertica license secret
env:
VERTICA_LICENSE: ${{ secrets.VERTICA_LICENSE }}
run: |
set -uo pipefail
# Accept both base64-encoded and raw license content (without echoing the value).
if printf '%s' "${VERTICA_LICENSE}" | base64 -d > /tmp/license.dat 2>/dev/null && [ -s /tmp/license.dat ]; then
echo "Decoded VERTICA_LICENSE as base64."
else
printf '%s' "${VERTICA_LICENSE}" > /tmp/license.dat
echo "Using VERTICA_LICENSE as raw license content."
fi
if [ ! -s /tmp/license.dat ]; then
echo "::error::Resulting license file is empty. Check the 'VERTICA_LICENSE' secret value."
rm -f /tmp/license.dat
exit 1
fi
kubectl delete secret vertica-license -n my-verticadb-operator --ignore-not-found
kubectl create secret generic vertica-license \
-n my-verticadb-operator \
--from-file=license.dat=/tmp/license.dat
rm -f /tmp/license.dat
# ---------------------------
# Vertica operator + DB deployment
# ---------------------------
- name: Install Vertica Operator
run: |
# Pin the chart version so a future major release of the
# verticadb-operator chart cannot unexpectedly break the pipeline.
# The operator reads the object-store region from the VerticaDB
# communal spec, so no extra operator values are required here.
helm install vdb-op vertica-charts/verticadb-operator \
-n my-verticadb-operator \
--version 25.4.0-0 \
--wait --timeout 10m
kubectl -n my-verticadb-operator get pods -o wide || true
- name: Deploy VerticaDB
run: |
cat > /tmp/verticadb.yaml <<'EOF'
apiVersion: vertica.com/v1
kind: VerticaDB
metadata:
name: verticadb-sample
namespace: my-verticadb-operator
annotations:
vertica.com/k-safety: "0"
spec:
image: opentext/vertica-k8s:latest
dbName: vdb
initPolicy: Create
licenseSecret: vertica-license
communal:
path: s3://vertica-fleeting/verticapy-ci/
credentialSecret: communal-creds
endpoint: http://minio.minio.svc.cluster.local:9000
region: us-east-1
local:
dataPath: /data
depotPath: /depot
# Writable scratch volume for server-side file exports (e.g.
# STV_Export2Shapefile used by vDataFrame.to_shp). The pod root
# filesystem is not writable by the fenced UDx process, so we mount
# an emptyDir owned by the pod fsGroup at /vertica-export.
volumes:
- name: vertica-export
emptyDir: {}
volumeMounts:
- name: vertica-export
mountPath: /vertica-export
subclusters:
- name: defaultsubcluster
size: 1
EOF
echo "--- VerticaDB manifest ---"
cat /tmp/verticadb.yaml
kubectl apply -f /tmp/verticadb.yaml
- name: Wait for Vertica readiness
run: |
NS=my-verticadb-operator
VDB=verticadb-sample
POD=${VDB}-defaultsubcluster-0
dump_diagnostics() {
kubectl -n ${NS} get vdb ${VDB} -o wide || true
kubectl -n ${NS} describe vdb ${VDB} || true
kubectl -n ${NS} get pods -o wide || true
kubectl -n ${NS} describe pod ${POD} || true
kubectl -n ${NS} logs ${POD} -c server --tail=200 || true
echo "--- operator logs ---"
kubectl -n ${NS} logs deploy/vdb-op-verticadb-operator-manager --tail=200 || \
kubectl -n ${NS} logs -l app.kubernetes.io/name=verticadb-operator --tail=200 || true
}
# DBInitialized is the operator's signal that the database was created,
# not merely that a pod exists.
if ! kubectl wait --for=condition=DBInitialized=True \
--namespace=${NS} vdb/${VDB} --timeout=15m; then
echo "::error::VerticaDB ${VDB} did not reach DBInitialized=True. Dumping diagnostics."
dump_diagnostics
exit 1
fi
if ! kubectl wait --for=condition=Ready pod/${POD} -n ${NS} --timeout=5m; then
echo "::error::Vertica pod ${POD} did not become Ready. Dumping diagnostics."
dump_diagnostics
exit 1
fi
kubectl -n ${NS} get pods -o wide || true
# ---------------------------
# Testing (tox on the runner via kubectl port-forward)
# ---------------------------
- name: Install dependencies
run: |
echo "Install tox"
pip install tox
- name: Run tests
run: |
set -uo pipefail
NS=my-verticadb-operator
SVC=verticadb-sample-defaultsubcluster
ENDPOINT_READY=false
for i in {1..30}; do
addrs=$(kubectl -n "${NS}" get endpoints "${SVC}" \
-o jsonpath='{.subsets[*].addresses[*].ip}' 2>/dev/null || true)
if [ -n "${addrs}" ]; then
ENDPOINT_READY=true
break
fi
sleep 5
done
if [ "${ENDPOINT_READY}" != "true" ]; then
echo "::error::Service ${SVC} has no ready endpoints after 30 attempts."
kubectl -n "${NS}" get endpoints "${SVC}" -o yaml || true
kubectl -n "${NS}" get pods -o wide || true
kubectl -n "${NS}" describe vdb verticadb-sample || true
exit 1
fi
kubectl -n ${NS} port-forward svc/${SVC} 5433:5433 > /tmp/pf.log 2>&1 &
PF_PID=$!
trap 'kill ${PF_PID} 2>/dev/null || true' EXIT
READY=false
for i in {1..30}; do
if (exec 3<>/dev/tcp/127.0.0.1/5433) 2>/dev/null; then
exec 3>&-
READY=true
break
fi
sleep 2
done
if [ "${READY}" != "true" ]; then
echo "::error::Vertica is not reachable on localhost:5433 after 30 attempts. Dumping diagnostics."
cat /tmp/pf.log || true
kubectl -n ${NS} get pods -o wide || true
kubectl -n ${NS} describe vdb verticadb-sample || true
exit 1
fi
echo "Vertica reachable on localhost:5433"
export VP_TEST_HOST=localhost
export VP_TEST_PORT=5433
export VP_TEST_USER=dbadmin
export VP_TEST_PASSWORD=""
export VP_TEST_DATABASE=vdb
# Server-side writable directory for shapefile export tests (to_shp).
export VP_TEST_SHP_DIR=/vertica-export/
tox -e py311
# ---------------------------
# Teardown
# ---------------------------
- name: Cleanup Kubernetes resources
if: always()
run: |
kubectl delete verticadb verticadb-sample -n my-verticadb-operator --ignore-not-found || true
helm uninstall vdb-op -n my-verticadb-operator || true
kubectl delete ns my-verticadb-operator --ignore-not-found || true
kubectl delete -f minio.yaml --ignore-not-found || true
kubectl delete ns minio --ignore-not-found || true
- name: Delete KinD cluster
if: always()
run: |
kind delete cluster --name vertica-ci || true