Skip to content
Merged
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
7 changes: 5 additions & 2 deletions .github/workflows/docker-cbdb-build-containers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ on:
paths:
- 'devops/deploy/docker/build/rocky8/**'
- 'devops/deploy/docker/build/rocky9/**'
- 'devops/deploy/docker/build/ubuntu22.04/**'
workflow_dispatch: # Manual trigger

# Prevent multiple workflow runs from interfering with each other
Expand All @@ -73,10 +74,10 @@ jobs:
timeout-minutes: 60
runs-on: ubuntu-latest

# Matrix strategy to build for both Rocky Linux 8 and 9
# Matrix strategy to build for both Rocky Linux 8 and 9, Ubuntu 22.04
strategy:
matrix:
platform: ['rocky8', 'rocky9']
platform: ['rocky8', 'rocky9', 'ubuntu22.04']

steps:
# Checkout repository code with full history
Expand All @@ -103,6 +104,8 @@ jobs:
- 'devops/deploy/docker/build/rocky8/**'
rocky9:
- 'devops/deploy/docker/build/rocky9/**'
ubuntu22.04:
- 'devops/deploy/docker/build/ubuntu22.04/**'

# Set up QEMU for multi-architecture support
# This allows building ARM64 images on AMD64 infrastructure and vice versa
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/docker-cbdb-test-containers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ on:
paths:
- 'devops/deploy/docker/test/rocky8/**'
- 'devops/deploy/docker/test/rocky9/**'
- 'devops/deploy/docker/test/ubuntu22.04/**'
workflow_dispatch: # Manual trigger

# Prevent multiple workflow runs from interfering with each other
Expand All @@ -62,8 +63,8 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
# Build for both Rocky Linux 8 and 9
platform: ['rocky8', 'rocky9']
# Build for both Rocky Linux 8 and 9, Ubuntu 22.04
platform: ['rocky8', 'rocky9', 'ubuntu22.04']

steps:
# Checkout repository code
Expand All @@ -87,6 +88,8 @@ jobs:
- 'devops/deploy/docker/test/rocky8/**'
rocky9:
- 'devops/deploy/docker/test/rocky9/**'
ubuntu22.04:
- 'devops/deploy/docker/test/ubuntu22.04/**'

# Skip if no changes for current platform
- name: Skip if not relevant
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
# Prerequisites:
# - configure-cloudberry.sh must be run first
# - Required build dependencies must be installed
# - /usr/local/cloudberry-db/lib must exist and be writable
# - ${BUILD_DESTINATION}/lib (by default /usr/local/cloudberry-db/lib) must exist and be writable
#
# Exit Codes:
# 0 - Build and installation completed successfully
Expand All @@ -71,7 +71,7 @@ init_environment "Cloudberry Build Script" "${BUILD_LOG}"

# Set environment
log_section "Environment Setup"
export LD_LIBRARY_PATH=/usr/local/cloudberry-db/lib:LD_LIBRARY_PATH
export LD_LIBRARY_PATH=${BUILD_DESTINATION}/lib:LD_LIBRARY_PATH
log_section_end "Environment Setup"

# Build process
Expand Down
29 changes: 28 additions & 1 deletion devops/build/automation/cloudberry/scripts/cloudberry-utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,23 @@
#
# --------------------------------------------------------------------

DEFAULT_BUILD_DESTINATION=/usr/local/cloudberry-db

# Initialize logging and environment
init_environment() {
local script_name=$1
local log_file=$2

init_build_destination_var

echo "=== Initializing environment for ${script_name} ==="
echo "${script_name} executed at $(date)" | tee -a "${log_file}"
echo "Whoami: $(whoami)" | tee -a "${log_file}"
echo "Hostname: $(hostname)" | tee -a "${log_file}"
echo "Working directory: $(pwd)" | tee -a "${log_file}"
echo "Source directory: ${SRC_DIR}" | tee -a "${log_file}"
echo "Log directory: ${LOG_DIR}" | tee -a "${log_file}"
echo "Build destination: ${BUILD_DESTINATION}" | tee -a "${log_file}"

if [ -z "${SRC_DIR:-}" ]; then
echo "Error: SRC_DIR environment variable is not set" | tee -a "${log_file}"
Expand Down Expand Up @@ -121,7 +126,7 @@ run_psql_cmd() {
# Function to source Cloudberry environment
source_cloudberry_env() {
echo "=== Sourcing Cloudberry environment ===" | tee -a "${LOG_DIR}/environment.log"
source /usr/local/cloudberry-db/cloudberry-env.sh
source ${BUILD_DESTINATION}/cloudberry-env.sh
source ${SRC_DIR}/../cloudberry/gpAux/gpdemo/gpdemo-env.sh
}

Expand All @@ -146,3 +151,25 @@ log_completion() {
local timestamp=$(date "+%Y.%m.%d-%H.%M.%S")
echo "${script_name} execution completed successfully at ${timestamp}" | tee -a "${log_file}"
}

# Function to get OS identifier
detect_os() {
if [ -f /etc/os-release ]; then
. /etc/os-release
OS_ID=$ID
OS_VERSION=$VERSION_ID
else
echo "Unsupported system: cannot detect OS" >&2
exit 99
fi
}

# Init BUILD_DESTINATION default value if not set
init_build_destination_var() {

if [ -z ${BUILD_DESTINATION+x} ]; then
export BUILD_DESTINATION=${DEFAULT_BUILD_DESTINATION}
exec "$@"
fi

}
27 changes: 17 additions & 10 deletions devops/build/automation/cloudberry/scripts/configure-cloudberry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# Description: Configures Apache Cloudberry build environment and runs
# ./configure with optimized settings. Performs the
# following:
# 1. Prepares /usr/local/cloudberry-db directory
# 1. Prepares ${BUILD_DESTINATION} (by default /usr/local/cloudberry-db) directory
# 2. Sets up library dependencies
# 3. Configures build with required features enabled
#
Expand All @@ -49,6 +49,7 @@
#
# Required Environment Variables:
# SRC_DIR - Root source directory
# BUILD_DESTINATION - Directory to build binaries
#
# Optional Environment Variables:
# LOG_DIR - Directory for logs (defaults to ${SRC_DIR}/build-logs)
Expand Down Expand Up @@ -92,6 +93,10 @@ set -euo pipefail
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "${SCRIPT_DIR}/cloudberry-utils.sh"

# Call it before conditional logic
detect_os
echo "Detected OS: $OS_ID $OS_VERSION"

# Define log directory and files
export LOG_DIR="${SRC_DIR}/build-logs"
CONFIGURE_LOG="${LOG_DIR}/configure.log"
Expand All @@ -101,18 +106,20 @@ init_environment "Cloudberry Configure Script" "${CONFIGURE_LOG}"

# Initial setup
log_section "Initial Setup"
execute_cmd sudo rm -rf /usr/local/cloudberry-db || exit 2
execute_cmd sudo rm -rf ${BUILD_DESTINATION} || exit 2
execute_cmd sudo chmod a+w /usr/local || exit 2
execute_cmd mkdir -p /usr/local/cloudberry-db/lib || exit 2
execute_cmd sudo cp /usr/local/xerces-c/lib/libxerces-c.so \
/usr/local/xerces-c/lib/libxerces-c-3.3.so \
/usr/local/cloudberry-db/lib || exit 3
execute_cmd sudo chown -R gpadmin:gpadmin /usr/local/cloudberry-db || exit 2
execute_cmd sudo mkdir -p ${BUILD_DESTINATION}/lib || exit 2
if [[ "$OS_ID" == "rocky" && "$OS_VERSION" =~ ^(8|9) ]]; then
execute_cmd sudo cp /usr/local/xerces-c/lib/libxerces-c.so \
/usr/local/xerces-c/lib/libxerces-c-3.3.so \
${BUILD_DESTINATION}/lib || exit 3
fi
execute_cmd sudo chown -R gpadmin:gpadmin ${BUILD_DESTINATION} || exit 2
log_section_end "Initial Setup"

# Set environment
log_section "Environment Setup"
export LD_LIBRARY_PATH=/usr/local/cloudberry-db/lib:LD_LIBRARY_PATH
export LD_LIBRARY_PATH=${BUILD_DESTINATION}/lib:LD_LIBRARY_PATH
log_section_end "Environment Setup"

# Add debug options if ENABLE_DEBUG is set to "true"
Expand All @@ -127,7 +134,7 @@ fi

# Configure build
log_section "Configure"
execute_cmd ./configure --prefix=/usr/local/cloudberry-db \
execute_cmd ./configure --prefix=${BUILD_DESTINATION} \
--disable-external-fts \
--enable-gpcloud \
--enable-ic-proxy \
Expand All @@ -152,7 +159,7 @@ execute_cmd ./configure --prefix=/usr/local/cloudberry-db \
--with-openssl \
--with-uuid=e2fs \
--with-includes=/usr/local/xerces-c/include \
--with-libraries=/usr/local/cloudberry-db/lib || exit 4
--with-libraries=${BUILD_DESTINATION}/lib || exit 4
log_section_end "Configure"

# Capture version information
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
# LOG_DIR - Directory for logs (defaults to ${SRC_DIR}/build-logs)
#
# Prerequisites:
# - Apache Cloudberry must be installed (/usr/local/cloudberry-db)
# - Apache Cloudberry must be installed (default location is /usr/local/cloudberry-db)
# - SSH must be configured for passwordless access to localhost
# - User must have permissions to create cluster directories
# - PostgreSQL client tools (psql) must be available
Expand Down Expand Up @@ -79,7 +79,7 @@ init_environment "Cloudberry Demo Cluster Script" "${CLUSTER_LOG}"

# Setup environment
log_section "Environment Setup"
source /usr/local/cloudberry-db/cloudberry-env.sh || exit 1
source ${BUILD_DESTINATION}/cloudberry-env.sh || exit 1
log_section_end "Environment Setup"

# Verify SSH access
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ init_environment "Cloudberry Unittest Script" "${UNITTEST_LOG}"

# Set environment
log_section "Environment Setup"
export LD_LIBRARY_PATH=/usr/local/cloudberry-db/lib:LD_LIBRARY_PATH
export LD_LIBRARY_PATH=${BUILD_DESTINATION}/lib:LD_LIBRARY_PATH
log_section_end "Environment Setup"

# Unittest process
Expand Down
Loading
Loading