Skip to content

Commit ac62924

Browse files
authored
Testing scripts (#20)
* Fix create-cluster script
1 parent 420a024 commit ac62924

15 files changed

Lines changed: 175 additions & 61 deletions

File tree

.github/workflows/docker-gpdb-build-conatiners.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ jobs:
9595
org.opencontainers.image.revision=${{ github.sha }}
9696
org.opencontainers.image.created=${{ steps.version.outputs.BUILD_DATE }}
9797
org.opencontainers.image.version=${{ steps.version.outputs.BUILD_DATE }}-${{ steps.version.outputs.SHA_SHORT }}
98+
org.opencontainers.image.description="Containerized environment for building and testing Greenplum Database. Includes all necessary dependencies, tools, and configurations to streamline the development and build process."
99+
org.opencontainers.image.title="Greenplum Build Environment"
98100
99101
# Generate a detailed build summary in GitHub Actions UI
100102
# This provides quick access to build information and image usage instructions

build_automation/gpdb/scripts/build-gpdb.sh

100644100755
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
# --------------------------------------------------------------------
2121
#
2222
# Script: build-gpdb.sh
23-
# Description: Builds Apache Cloudberry from source code and installs
23+
# Description: Builds Greenplum from source code and installs
2424
# it.
2525
# Performs the following steps:
2626
# 1. Builds main open-gpdb database components
@@ -29,7 +29,7 @@
2929
# Uses parallel compilation based on available CPU cores.
3030
#
3131
# Required Environment Variables:
32-
# SRC_DIR - Root source directory containing Apache Cloudberry
32+
# SRC_DIR - Root source directory containing Greenplum
3333
# source code
3434
#
3535
# Optional Environment Variables:
@@ -45,7 +45,7 @@
4545
# ./build-gpdb.sh
4646
#
4747
# Prerequisites:
48-
# - configure-cloudberry.sh must be run first
48+
# - configure-gpdb.sh must be run first
4949
# - Required build dependencies must be installed
5050
# - /usr/local/cloudberry-db/lib must exist and be writable
5151
#

build_automation/gpdb/scripts/configure-gpdb.sh

100644100755
File mode changed.

build_automation/gpdb/scripts/create-gpdb-demo-cluster.sh

100644100755
Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
#
2020
# --------------------------------------------------------------------
2121
#
22-
# Script: create-cloudberry-demo-cluster.sh
23-
# Description: Creates and configures a demo Apache Cloudbery cluster.
22+
# Script: create-gpdb-demo-cluster.sh
23+
# Description: Creates and configures a demo Greenplum cluster.
2424
# Performs the following steps:
2525
# 1. Sets up required environment variables
2626
# 2. Verifies SSH connectivity
@@ -35,19 +35,19 @@
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+
# - Greenplum must be installed (/opt/greenplum-db-6)
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
4242
#
4343
# Usage:
4444
# Export required variables:
45-
# export SRC_DIR=/path/to/cloudberry/source
45+
# export SRC_DIR=/path/to/gpdb/source
4646
# Then run:
47-
# ./create-cloudberry-demo-cluster.sh
47+
# ./create-gpdb-demo-cluster.sh
4848
#
4949
# Verification Checks:
50-
# - Apache Cloudberry version
50+
# - Greenplum version
5151
# - Segment configuration
5252
# - Available extensions
5353
# - Active sessions
@@ -66,35 +66,38 @@
6666

6767
set -euo pipefail
6868

69+
export BUILD_DESTINATION="/opt/greenplum-db-6"
70+
6971
# Source common utilities
7072
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
71-
source "${SCRIPT_DIR}/cloudberry-utils.sh"
73+
source "${SCRIPT_DIR}/gpdb-utils.sh"
7274

7375
# Define log directory
7476
export LOG_DIR="${SRC_DIR}/build-logs"
77+
mkdir -p "${LOG_DIR}"
7578
CLUSTER_LOG="${LOG_DIR}/cluster.log"
7679

7780
# Initialize environment
78-
init_environment "Cloudberry Demo Cluster Script" "${CLUSTER_LOG}"
81+
init_environment "Greenplum Demo Cluster Script" "${CLUSTER_LOG}" "/opt/greenplum-db-6"
7982

8083
# Setup environment
8184
log_section "Environment Setup"
82-
source /usr/local/cloudberry-db/greenplum_path.sh || exit 1
85+
source /opt/greenplum-db-6/greenplum_path.sh || exit 1
8386
log_section_end "Environment Setup"
8487

85-
# Verify SSH access
88+
# # Verify SSH access
8689
log_section "SSH Verification"
8790
execute_cmd ssh $(hostname) 'whoami; hostname' || exit 2
8891
log_section_end "SSH Verification"
8992

9093
# Create demo cluster
9194
log_section "Demo Cluster Creation"
92-
execute_cmd make create-demo-cluster --directory ${SRC_DIR}/../cloudberry || exit 3
95+
execute_cmd make create-demo-cluster --directory ${SRC_DIR}/../gpdb || exit 3
9396
log_section_end "Demo Cluster Creation"
9497

9598
# Source demo environment
9699
log_section "Source Environment"
97-
source ${SRC_DIR}/../cloudberry/gpAux/gpdemo/gpdemo-env.sh || exit 1
100+
source ${SRC_DIR}/../gpdb/gpAux/gpdemo/gpdemo-env.sh || exit 1
98101
log_section_end "Source Environment"
99102

100103
# Manage cluster state
@@ -121,5 +124,5 @@ fi
121124
log_section_end "Installation Verification"
122125

123126
# Log completion
124-
log_completion "Cloudberry Demo Cluster Script" "${CLUSTER_LOG}"
127+
log_completion "Greenplum Demo Cluster Script" "${CLUSTER_LOG}"
125128
exit 0

build_automation/gpdb/scripts/destroy-gpdb-demo-cluster.sh

100644100755
Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
#
2020
# --------------------------------------------------------------------
2121
#
22-
# Script: destroy-cloudberry-demo-cluster.sh
23-
# Description: Destroys and cleans up a demo Apache Cloudberry
22+
# Script: destroy-gpdb-demo-cluster.sh
23+
# Description: Destroys and cleans up a demo Greenplum
2424
# cluster.
2525
# Performs the following steps:
2626
# 1. Sources required environment variables
@@ -35,23 +35,23 @@
3535
# LOG_DIR - Directory for logs (defaults to ${SRC_DIR}/build-logs)
3636
#
3737
# Prerequisites:
38-
# - Apache Cloudberry environment must be available
38+
# - Greenplum environment must be available
3939
# - User must have permissions to remove cluster directories
4040
# - No active connections to the cluster
4141
#
4242
# Usage:
4343
# Export required variables:
44-
# export SRC_DIR=/path/to/cloudberry/source
44+
# export SRC_DIR=/path/to/gpdb/source
4545
# Then run:
46-
# ./destroy-cloudberry-demo-cluster.sh
46+
# ./destroy-gpdb-demo-cluster.sh
4747
#
4848
# Exit Codes:
4949
# 0 - Cluster destroyed successfully
5050
# 1 - Environment setup/sourcing failed
5151
# 2 - Cluster destruction failed
5252
#
5353
# Related Scripts:
54-
# - create-cloudberry-demo-cluster.sh: Creates a new demo cluster
54+
# - create-gpdb-demo-cluster.sh: Creates a new demo cluster
5555
#
5656
# Notes:
5757
# - This script will forcefully terminate all cluster processes
@@ -64,38 +64,38 @@ set -euo pipefail
6464

6565
# Source common utilities
6666
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
67-
source "${SCRIPT_DIR}/cloudberry-utils.sh"
67+
source "${SCRIPT_DIR}/gpdb-utils.sh"
6868

6969
# Define log directory
7070
export LOG_DIR="${SRC_DIR}/build-logs"
7171
CLUSTER_LOG="${LOG_DIR}/destroy-cluster.log"
7272

7373
# Initialize environment
74-
init_environment "Destroy Cloudberry Demo Cluster Script" "${CLUSTER_LOG}"
74+
init_environment "Destroy Greenplum Demo Cluster Script" "${CLUSTER_LOG}" "/opt/greenplum-db-6"
7575

76-
# Source Cloudberry environment
76+
# Source Greenplum environment
7777
log_section "Environment Setup"
78-
source_cloudberry_env || {
79-
echo "Failed to source Cloudberry environment" | tee -a "${CLUSTER_LOG}"
78+
source_greenplum_env || {
79+
echo "Failed to source Greenplum environment" | tee -a "${CLUSTER_LOG}"
8080
exit 1
8181
}
8282
log_section_end "Environment Setup"
8383

8484
# Destroy demo cluster
8585
log_section "Destroy Demo Cluster"
86-
execute_cmd make destroy-demo-cluster --directory ${SRC_DIR}/../cloudberry || {
86+
execute_cmd make destroy-demo-cluster --directory ${SRC_DIR}/../gpdb || {
8787
echo "Failed to destroy demo cluster" | tee -a "${CLUSTER_LOG}"
8888
exit 2
8989
}
9090
log_section_end "Destroy Demo Cluster"
9191

9292
# Verify cleanup
9393
log_section "Cleanup Verification"
94-
if [ -d "${SRC_DIR}/../cloudberry/gpAux/gpdemo/data" ]; then
94+
if [ -d "${SRC_DIR}/../gpdb/gpAux/gpdemo/data" ]; then
9595
echo "Warning: Data directory still exists after cleanup" | tee -a "${CLUSTER_LOG}"
9696
fi
9797
log_section_end "Cleanup Verification"
9898

9999
# Log completion
100-
log_completion "Destroy Cloudberry Demo Cluster Script" "${CLUSTER_LOG}"
100+
log_completion "Destroy Greenplum Demo Cluster Script" "${CLUSTER_LOG}"
101101
exit 0

build_automation/gpdb/scripts/gpdb-utils.sh

100644100755
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ run_psql_cmd() {
5656
return ${PIPESTATUS[0]}
5757
}
5858

59-
# Function to source Cloudberry environment
60-
source_cloudberry_env() {
61-
echo "=== Sourcing Cloudberry environment ===" | tee -a "${LOG_DIR}/environment.log"
62-
source /usr/local/cloudberry-db/greenplum_path.sh
63-
source ${SRC_DIR}/../cloudberry/gpAux/gpdemo/gpdemo-env.sh
59+
# Function to source Greenplum environment
60+
source_greenplum_env() {
61+
echo "=== Sourcing Greenplum environment ===" | tee -a "${LOG_DIR}/environment.log"
62+
source ${BUILD_DESTINATION}/greenplum_path.sh
63+
source ${SRC_DIR}/../gpdb/gpAux/gpdemo/gpdemo-env.sh
6464
}
6565

6666
# Function to log section start

build_automation/gpdb/scripts/parse-results.pl

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
# --------------------------------------------------------------------
2121
#
2222
# Script: parse_results.pl
23-
# Description: Processes Cloudberry test output to extract statistics
23+
# Description: Processes Greenplum test output to extract statistics
2424
# and results.
2525
# Analyzes test log files to determine:
2626
# 1. Overall test status (pass/fail)

build_automation/gpdb/scripts/parse-test-results.sh

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
# --------------------------------------------------------------------
2121
#
2222
# Script: parse-test-results.sh
23-
# Description: Parses Apache Cloudberry test results and processes the
23+
# Description: Parses Greenplum test results and processes the
2424
# output.
2525
# Provides GitHub Actions integration and environment
2626
# variable export functionality. This script is a wrapper

build_automation/gpdb/scripts/test-gpdb.sh

100644100755
Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919
#
2020
# --------------------------------------------------------------------
2121
#
22-
# Script: test-cloudberry.sh
23-
# Description: Executes Apache Cloudberry test suite using specified
22+
# Script: test-gpdb.sh
23+
# Description: Executes Greenplum test suite using specified
2424
# make target. Supports different test types through make
25-
# target configuration. Sources Cloudberry environment
25+
# target configuration. Sources Greenplum environment
2626
# before running tests.
2727
#
2828
# Required Environment Variables:
@@ -34,13 +34,17 @@
3434
# LOG_DIR - Directory for logs (defaults to build-logs)
3535
# PGOPTIONS - PostgreSQL server options
3636
#
37+
# Prerequisites:
38+
# - Greenplum must be installed (/opt/greenplum-db-6)
39+
# - create-gpdb-demo-cluster.sh must be run first
40+
#
3741
# Usage:
3842
# Export required variables:
3943
# export MAKE_TARGET=installcheck-world
4044
# export MAKE_DIRECTORY="/path/to/make/dir"
4145
# export MAKE_NAME="Install Check"
4246
# Then run:
43-
# ./test-cloudberry.sh
47+
# ./test-gpdb.sh
4448
#
4549
# Exit Codes:
4650
# 0 - All tests passed successfully
@@ -51,20 +55,22 @@
5155

5256
set -euo pipefail
5357

58+
export BUILD_DESTINATION="/opt/greenplum-db-6"
59+
5460
# Source common utilities
5561
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
56-
source "${SCRIPT_DIR}/cloudberry-utils.sh"
62+
source "${SCRIPT_DIR}/gpdb-utils.sh"
5763

5864
# Define log directory and files
5965
export LOG_DIR="build-logs"
6066
TEST_LOG="${LOG_DIR}/test.log"
6167

6268
# Initialize environment
63-
init_environment "Cloudberry Test Script" "${TEST_LOG}"
69+
init_environment "Greenplum Test Script" "${TEST_LOG}" "/opt/greenplum-db-6"
6470

65-
# Source Cloudberry environment
71+
# Source Greenplum environment
6672
log_section "Environment Setup"
67-
source_cloudberry_env || exit 1
73+
source_greenplum_env || exit 1
6874
log_section_end "Environment Setup"
6975

7076
echo "MAKE_TARGET: ${MAKE_TARGET}"
@@ -77,5 +83,5 @@ execute_cmd make ${MAKE_TARGET} ${MAKE_DIRECTORY} || exit 2
7783
log_section_end "Install Check"
7884

7985
# Log completion
80-
log_completion "Cloudberry Test Script" "${TEST_LOG}"
86+
log_completion "Greenplum Test Script" "${TEST_LOG}"
8187
exit 0

images/docker/gpdb/build/jammy/Dockerfile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ RUN apt-get update -o Acquire::AllowInsecureRepositories=true && apt-get install
4848
g++-11 \
4949
g++-11-multilib \
5050
git \
51+
iputils-ping \
5152
krb5-multidev \
5253
libapr1-dev \
5354
libbz2-dev \
@@ -65,10 +66,12 @@ RUN apt-get update -o Acquire::AllowInsecureRepositories=true && apt-get install
6566
libaprutil1-dev \
6667
libpam0g-dev \
6768
libpam0g \
69+
libpopt0 \
6870
libcgroup1 \
6971
libyaml-0-2 \
7072
libldap-2.5-0 \
7173
libssl3 \
74+
net-tools \
7275
ninja-build \
7376
python-setuptools \
7477
quilt \
@@ -80,6 +83,9 @@ RUN apt-get update -o Acquire::AllowInsecureRepositories=true && apt-get install
8083
libgpgme11 \
8184
python2.7 \
8285
python2.7-dev \
86+
python-pip \
87+
python-six \
88+
rsync \
8389
sudo \
8490
iproute2 \
8591
less \
@@ -88,6 +94,9 @@ RUN apt-get update -o Acquire::AllowInsecureRepositories=true && apt-get install
8894
openssh-server \
8995
locales
9096

97+
98+
RUN pip2 install psutil
99+
91100
RUN apt-get install -y locales \
92101
&& locale-gen "en_US.UTF-8" \
93102
&& update-locale LC_ALL="en_US.UTF-8"
@@ -123,3 +132,15 @@ USER gpadmin
123132
WORKDIR /home/gpadmin
124133

125134
RUN sudo DEBIAN_FRONTEND=noninteractive apt install -y libhyperic-sigar-java libaprutil1-dev libuv1-dev
135+
136+
# --------------------------------------------------------------------
137+
# Set the Default User and Command
138+
# --------------------------------------------------------------------
139+
# The default user is set to 'gpadmin', and the container starts by
140+
# running the init_system.sh script. This container serves as a base
141+
# environment, and the Greenplum Database DEB package can be installed
142+
# for testing and functional verification.
143+
# --------------------------------------------------------------------
144+
USER gpadmin
145+
146+
CMD ["bash","-c","/tmp/init_system.sh"]

0 commit comments

Comments
 (0)