Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions .github/scripts/cloudberry-smoke.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed
# with this work for additional information regarding copyright
# ownership. The ASF licenses this file to You under the Apache
# License, Version 2.0 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of the
# License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied. See the License for the specific language governing
# permissions and limitations under the License.

set -euo pipefail

# Requires a running demo cluster and its sourced Cloudberry/gpdemo environment.
root=$(pwd)
mkdir -p ci-smoke
cd ci-smoke
psql -X -v ON_ERROR_STOP=1 -d postgres -c 'CREATE EXTENSION IF NOT EXISTS gp_stats_collector'
psql -X -v ON_ERROR_STOP=1 -d postgres -c 'SELECT version(); SELECT * FROM gp_segment_configuration'
[[ $(psql -X -At -d postgres -c 'SHOW gpsc.enable') == on ]]
cat > yagpcc.yaml <<EOF
role: coordinator
listen_port: 1432
ping_port: 1435
csv_port: 1440
ui_port: 1441
socket_file: $PWD/agent.sock
lockfile: $PWD/agent.lock
uds_file: /tmp/gpsc_agent.sock
segment_pull_rate_sec: 2
segment_pull_threads: 2
coordinator_connection:
addrs: ["127.0.0.1:${PGPORT}"]
db: postgres
user: $(id -un)
sslmode: disable
app:
app_name: command-center-ci
logging:
level: debug
file: stdout
instrumentation:
addr: "127.0.0.1:1433"
EOF
"$root/devbin/yagpcc" --config-path "$PWD" > agent.log 2>&1 &
agent_pid=$!
trap 'kill "$agent_pid" 2>/dev/null || true; wait "$agent_pid" 2>/dev/null || true' EXIT
# A successful process start alone does not establish database connectivity.
# This endpoint goes through the coordinator gRPC service to the real catalog.
for attempt in {1..60}; do
kill -0 "$agent_pid"
if curl --noproxy '*' --fail --silent --max-time 5 'http://[::1]:1441/api/databases' > databases.json; then
if python3 -c 'import json; assert "postgres" in json.load(open("databases.json"))["databases"]'; then
curl --noproxy '*' --fail --silent --max-time 5 'http://[::1]:1441/' > index.html
grep -q '<html' index.html
cat databases.json
echo 'Cloudberry + Command Center smoke test passed'
exit 0
fi
fi
sleep 2
done
cat agent.log
exit 1
58 changes: 58 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,61 @@ jobs:
env:
YAGPCC_CH_ADDR: 127.0.0.1:9000
run: go test -tags=integration -v -count=1 -timeout=10m ./internal/sink/clickhouse/...

cloudberry-integration:
runs-on: ubuntu-latest
needs: tests
timeout-minutes: 90
container:
image: apache/incubator-cloudberry:cbdb-build-rocky9-latest
options: --privileged --user root --hostname cdw --shm-size=2gb
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v5
- name: Checkout Cloudberry main
uses: actions/checkout@v5
with:
repository: apache/cloudberry
ref: main
path: cloudberry
submodules: true
- uses: actions/setup-go@v6
with:
go-version: '1.25'
- uses: actions/setup-node@v6
with:
node-version: '22'
- name: Build Command Center with UI
run: |
make build-ui
go build -o devbin/yagpcc ./cmd/server
# Follow apache/cloudberry's CI environment, build and demo steps.
# Keep the checkout named cloudberry: the upstream demo script uses it.
- name: Initialize Cloudberry environment
run: |
su - gpadmin -c /tmp/init_system.sh
echo "SRC_DIR=${GITHUB_WORKSPACE}/cloudberry" >> "$GITHUB_ENV"
chown -R gpadmin:gpadmin "$GITHUB_WORKSPACE"
- name: Configure and build Cloudberry
run: |
su - gpadmin -c "cd '${SRC_DIR}' && SRC_DIR='${SRC_DIR}' devops/build/automation/cloudberry/scripts/configure-cloudberry.sh"
su - gpadmin -c "cd '${SRC_DIR}' && SRC_DIR='${SRC_DIR}' devops/build/automation/cloudberry/scripts/build-cloudberry.sh"
- name: Create Cloudberry demo cluster
run: |
su - gpadmin -c "cd '${SRC_DIR}' && SRC_DIR='${SRC_DIR}' WITH_MIRRORS=false BLDWRAP_POSTGRES_CONF_ADDONS='shared_preload_libraries=gp_stats_collector|gpsc.enable=on' devops/build/automation/cloudberry/scripts/create-cloudberry-demo-cluster.sh"
- name: Launch Command Center and check database API
run: |
su - gpadmin -c "cd '${GITHUB_WORKSPACE}' && source /usr/local/cloudberry-db/cloudberry-env.sh && source '${SRC_DIR}/gpAux/gpdemo/gpdemo-env.sh' && bash .github/scripts/cloudberry-smoke.sh"
- name: Show integration logs
if: always()
run: |
cat ci-smoke/agent.log 2>/dev/null || true
tail -n 100 cloudberry/build-logs/cluster.log 2>/dev/null || true
- name: Stop demo cluster
if: always()
run: |
if [[ -f cloudberry/gpAux/gpdemo/gpdemo-env.sh ]]; then
su - gpadmin -c "source /usr/local/cloudberry-db/cloudberry-env.sh && source '${GITHUB_WORKSPACE}/cloudberry/gpAux/gpdemo/gpdemo-env.sh' && gpstop -a"
fi
Loading