Skip to content

Commit cd0bfbc

Browse files
author
Leonid Borchuk
committed
Add ubuntu22.04 build/test docker containers
Ubuntu is one of the most popular Linux distros and is widely used not only on workstations, but also on server-side platforms. We use Debian-based distributions as the main operating system platform in our environment. Greenplum works on Ubuntu without any issues, and our tests with Cloudberry show the same. Here I have added support for Ubuntu Jammy LTS in Cloudberry. As for Rocky Linux distros, we create a Docker container with all dependencies already resolved. Then, we build a Debian package using debhelper inside the container. The container can also be used to run tests, but that is outside the scope of this PR. Also there is some changes compared to RPM-based builds: 1. Debian packages (and docker containers) does not need to build libxerces since 22.04 repo contains libxerces-c3.2. libxerces-c3.2 fits perfectly for cloudberry. 2. Debian prohibits install something inside /usr/local/. So we need to build our binaries somewhere else, then list relative local build paths in control file and finally write install script to copy it in /usr/local/cloudberry-db. In reality we just build to /usr/cloudberry-db and then create symbolic link /usr/cloudberry-db -> /usr/local/cloudberry-db
1 parent 1d9a1f2 commit cd0bfbc

28 files changed

Lines changed: 1542 additions & 21 deletions

.github/workflows/docker-cbdb-build-containers.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ on:
6060
paths:
6161
- 'devops/deploy/docker/build/rocky8/**'
6262
- 'devops/deploy/docker/build/rocky9/**'
63+
- 'devops/deploy/docker/build/ubuntu22.04/**'
6364
workflow_dispatch: # Manual trigger
6465

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

76-
# Matrix strategy to build for both Rocky Linux 8 and 9
77+
# Matrix strategy to build for both Rocky Linux 8 and 9, Ubuntu 22.04
7778
strategy:
7879
matrix:
79-
platform: ['rocky8', 'rocky9']
80+
platform: ['rocky8', 'rocky9', 'ubuntu22.04']
8081

8182
steps:
8283
# Checkout repository code with full history
@@ -103,6 +104,8 @@ jobs:
103104
- 'devops/deploy/docker/build/rocky8/**'
104105
rocky9:
105106
- 'devops/deploy/docker/build/rocky9/**'
107+
ubuntu22.04:
108+
- 'devops/deploy/docker/build/ubuntu22.04/**'
106109
107110
# Set up QEMU for multi-architecture support
108111
# This allows building ARM64 images on AMD64 infrastructure and vice versa

.github/workflows/docker-cbdb-test-containers.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ on:
4949
paths:
5050
- 'devops/deploy/docker/test/rocky8/**'
5151
- 'devops/deploy/docker/test/rocky9/**'
52+
- 'devops/deploy/docker/test/ubuntu22.04/**'
5253
workflow_dispatch: # Manual trigger
5354

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

6869
steps:
6970
# Checkout repository code
@@ -87,6 +88,8 @@ jobs:
8788
- 'devops/deploy/docker/test/rocky8/**'
8889
rocky9:
8990
- 'devops/deploy/docker/test/rocky9/**'
91+
ubuntu22.04:
92+
- 'devops/deploy/docker/test/ubuntu22.04/**'
9093
9194
# Skip if no changes for current platform
9295
- name: Skip if not relevant

devops/build/automation/cloudberry/scripts/build-cloudberry.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
# Prerequisites:
4646
# - configure-cloudberry.sh must be run first
4747
# - Required build dependencies must be installed
48-
# - /usr/local/cloudberry-db/lib must exist and be writable
48+
# - ${BUILD_DESTINATION}/lib (by default /usr/local/cloudberry-db/lib) must exist and be writable
4949
#
5050
# Exit Codes:
5151
# 0 - Build and installation completed successfully
@@ -71,7 +71,7 @@ init_environment "Cloudberry Build Script" "${BUILD_LOG}"
7171

7272
# Set environment
7373
log_section "Environment Setup"
74-
export LD_LIBRARY_PATH=/usr/local/cloudberry-db/lib:LD_LIBRARY_PATH
74+
export LD_LIBRARY_PATH=${BUILD_DESTINATION}/lib:LD_LIBRARY_PATH
7575
log_section_end "Environment Setup"
7676

7777
# Build process

devops/build/automation/cloudberry/scripts/cloudberry-utils.sh

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,18 +79,23 @@
7979
#
8080
# --------------------------------------------------------------------
8181

82+
DEFAULT_BUILD_DESTINATION=/usr/local/cloudberry-db
83+
8284
# Initialize logging and environment
8385
init_environment() {
8486
local script_name=$1
8587
local log_file=$2
8688

89+
init_build_destination_var
90+
8791
echo "=== Initializing environment for ${script_name} ==="
8892
echo "${script_name} executed at $(date)" | tee -a "${log_file}"
8993
echo "Whoami: $(whoami)" | tee -a "${log_file}"
9094
echo "Hostname: $(hostname)" | tee -a "${log_file}"
9195
echo "Working directory: $(pwd)" | tee -a "${log_file}"
9296
echo "Source directory: ${SRC_DIR}" | tee -a "${log_file}"
9397
echo "Log directory: ${LOG_DIR}" | tee -a "${log_file}"
98+
echo "Build destination: ${BUILD_DESTINATION}" | tee -a "${log_file}"
9499

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

@@ -146,3 +151,25 @@ log_completion() {
146151
local timestamp=$(date "+%Y.%m.%d-%H.%M.%S")
147152
echo "${script_name} execution completed successfully at ${timestamp}" | tee -a "${log_file}"
148153
}
154+
155+
# Function to get OS identifier
156+
detect_os() {
157+
if [ -f /etc/os-release ]; then
158+
. /etc/os-release
159+
OS_ID=$ID
160+
OS_VERSION=$VERSION_ID
161+
else
162+
echo "Unsupported system: cannot detect OS" >&2
163+
exit 99
164+
fi
165+
}
166+
167+
# Init BUILD_DESTINATION default value if not set
168+
init_build_destination_var() {
169+
170+
if [ -z ${BUILD_DESTINATION+x} ]; then
171+
export BUILD_DESTINATION=${DEFAULT_BUILD_DESTINATION}
172+
exec "$@"
173+
fi
174+
175+
}

devops/build/automation/cloudberry/scripts/configure-cloudberry.sh

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
# Description: Configures Apache Cloudberry build environment and runs
2424
# ./configure with optimized settings. Performs the
2525
# following:
26-
# 1. Prepares /usr/local/cloudberry-db directory
26+
# 1. Prepares ${BUILD_DESTINATION} (by default /usr/local/cloudberry-db) directory
2727
# 2. Sets up library dependencies
2828
# 3. Configures build with required features enabled
2929
#
@@ -49,6 +49,7 @@
4949
#
5050
# Required Environment Variables:
5151
# SRC_DIR - Root source directory
52+
# BUILD_DESTINATION - Directory to build binaries
5253
#
5354
# Optional Environment Variables:
5455
# LOG_DIR - Directory for logs (defaults to ${SRC_DIR}/build-logs)
@@ -92,6 +93,10 @@ set -euo pipefail
9293
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
9394
source "${SCRIPT_DIR}/cloudberry-utils.sh"
9495

96+
# Call it before conditional logic
97+
detect_os
98+
echo "Detected OS: $OS_ID $OS_VERSION"
99+
95100
# Define log directory and files
96101
export LOG_DIR="${SRC_DIR}/build-logs"
97102
CONFIGURE_LOG="${LOG_DIR}/configure.log"
@@ -101,18 +106,20 @@ init_environment "Cloudberry Configure Script" "${CONFIGURE_LOG}"
101106

102107
# Initial setup
103108
log_section "Initial Setup"
104-
execute_cmd sudo rm -rf /usr/local/cloudberry-db || exit 2
109+
execute_cmd sudo rm -rf ${BUILD_DESTINATION} || exit 2
105110
execute_cmd sudo chmod a+w /usr/local || exit 2
106-
execute_cmd mkdir -p /usr/local/cloudberry-db/lib || exit 2
107-
execute_cmd sudo cp /usr/local/xerces-c/lib/libxerces-c.so \
108-
/usr/local/xerces-c/lib/libxerces-c-3.3.so \
109-
/usr/local/cloudberry-db/lib || exit 3
110-
execute_cmd sudo chown -R gpadmin:gpadmin /usr/local/cloudberry-db || exit 2
111+
execute_cmd sudo mkdir -p ${BUILD_DESTINATION}/lib || exit 2
112+
if [[ "$OS_ID" == "rocky" && "$OS_VERSION" =~ ^(8|9) ]]; then
113+
execute_cmd sudo cp /usr/local/xerces-c/lib/libxerces-c.so \
114+
/usr/local/xerces-c/lib/libxerces-c-3.3.so \
115+
${BUILD_DESTINATION}/lib || exit 3
116+
fi
117+
execute_cmd sudo chown -R gpadmin:gpadmin ${BUILD_DESTINATION} || exit 2
111118
log_section_end "Initial Setup"
112119

113120
# Set environment
114121
log_section "Environment Setup"
115-
export LD_LIBRARY_PATH=/usr/local/cloudberry-db/lib:LD_LIBRARY_PATH
122+
export LD_LIBRARY_PATH=${BUILD_DESTINATION}/lib:LD_LIBRARY_PATH
116123
log_section_end "Environment Setup"
117124

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

128135
# Configure build
129136
log_section "Configure"
130-
execute_cmd ./configure --prefix=/usr/local/cloudberry-db \
137+
execute_cmd ./configure --prefix=${BUILD_DESTINATION} \
131138
--disable-external-fts \
132139
--enable-gpcloud \
133140
--enable-ic-proxy \
@@ -152,7 +159,7 @@ execute_cmd ./configure --prefix=/usr/local/cloudberry-db \
152159
--with-openssl \
153160
--with-uuid=e2fs \
154161
--with-includes=/usr/local/xerces-c/include \
155-
--with-libraries=/usr/local/cloudberry-db/lib || exit 4
162+
--with-libraries=${BUILD_DESTINATION}/lib || exit 4
156163
log_section_end "Configure"
157164

158165
# Capture version information

devops/build/automation/cloudberry/scripts/create-cloudberry-demo-cluster.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
# LOG_DIR - Directory for logs (defaults to ${SRC_DIR}/build-logs)
3636
#
3737
# Prerequisites:
38-
# - Apache Cloudberry must be installed (/usr/local/cloudberry-db)
38+
# - Apache Cloudberry must be installed (default location is /usr/local/cloudberry-db)
3939
# - SSH must be configured for passwordless access to localhost
4040
# - User must have permissions to create cluster directories
4141
# - PostgreSQL client tools (psql) must be available
@@ -79,7 +79,7 @@ init_environment "Cloudberry Demo Cluster Script" "${CLUSTER_LOG}"
7979

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

8585
# Verify SSH access

devops/build/automation/cloudberry/scripts/unittest-cloudberry.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ init_environment "Cloudberry Unittest Script" "${UNITTEST_LOG}"
5656

5757
# Set environment
5858
log_section "Environment Setup"
59-
export LD_LIBRARY_PATH=/usr/local/cloudberry-db/lib:LD_LIBRARY_PATH
59+
export LD_LIBRARY_PATH=${BUILD_DESTINATION}/lib:LD_LIBRARY_PATH
6060
log_section_end "Environment Setup"
6161

6262
# Unittest process

0 commit comments

Comments
 (0)