diff --git a/.github/scripts/cloudberry-smoke.sh b/.github/scripts/cloudberry-smoke.sh new file mode 100644 index 00000000..4002f42e --- /dev/null +++ b/.github/scripts/cloudberry-smoke.sh @@ -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 < 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 '> "$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