Files
documentdb/scripts/install_setup_rum_oss.sh
Vinod Sridharan 094d546f64 Merged PR 1680621: Use OSS RUM source in OSS build
### Does this PR have any customer impact?

### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)

### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)

### Are you introducing any new config? If yes, do you have tests with and without them being set?

### ChangeLog (Refer [Template](../oss/CHANGELOG.md))

### Description

Use OSS RUM source in OSS build

----
#### AI description  (iteration 1)
#### PR Classification
This pull request implements a feature update to enable the OSS build to use the OSS RUM source through configurable parameters and script modifications.

#### PR Summary
The PR refactors build scripts and extension routines to support toggling between private and OSS RUM sources. Key changes include:
- **`scripts/pipeline_build_extension_core.sh`**: Converted positional parameters to flag-based arguments using getopts and added a conditional to select OSS RUM installation.
- **`pipelines/templates/extension_build_core.yml` & `.pipelines/templates/oss_documentdb_build.yml`**: Introduced the `useOssRumRepo` parameter to control whether the OSS RUM source is used.
- **`/oss/pg_documentdb/src/index_am/rum.c`**: Updated index routine functions to directly call OSS-specific implementations when the new composite index feature is enabled.
- **`scripts/build_dev_flex_container.sh`**: Adjusted the call to the pipeline build script to use the new flag-based argument format.
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
2025-05-29 12:12:31 +08:00

54 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
# fail if trying to reference a variable that is not set.
set -u
# exit immediately if a command exits with a non-zero status
set -e
source="${BASH_SOURCE[0]}"
while [[ -h $source ]]; do
scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
source="$(readlink "$source")"
# if $source was a relative symlink, we need to resolve it relative to the path where the
# symlink file was located
[[ $source != /* ]] && source="$scriptroot/$source"
done
scriptDir="$( cd -P "$( dirname "$source" )" && pwd )"
echo "scriptDir: $scriptDir"
. $scriptDir/setup_versions.sh
RUM_REF=$(GetRumVersion)
. $scriptDir/utils.sh
if [ "${PGVERSION:-}" != "" ]; then
pgPath=$(GetPostgresPath $PGVERSION)
PATH=$pgPath:$PATH
fi
pushd $INSTALL_DEPENDENCIES_ROOT
rm -rf rum-repo
mkdir rum-repo
cd rum-repo
git init
git remote add origin https://github.com/postgrespro/rum.git
git fetch --depth 1 origin "$RUM_REF"
git checkout FETCH_HEAD
echo "building and installing rum extension ..."
echo $PATH
if [ "${DESTINSTALLDIR:-""}" == "" ]; then
sudo PATH=$PATH -E make USE_PGXS=1
sudo PATH=$PATH -E make install USE_PGXS=1
else
make USE_PGXS=1
make USE_PGXS=1 DESTDIR=$DESTINSTALLDIR install
fi
popd
if [ "${CLEANUP_SETUP:-"0"}" == "1" ]; then
rm -rf $INSTALL_DEPENDENCIES_ROOT/rum-repo
fi