Merged PR 1533455: [oss] Declare and use fixed version of packages

### 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?

### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))

### Description
In oss, we noticed frequently sql test result difference introduced by newer package minor versions (postgres, pgvector, postgis, etc).

To make oss CI integration stable and to make test result consistent in oss and pgmongo, we should specify fixed versions for packages in oss, and align with pgmongo.

Will depend on manual package version update after verifying the compatibility and meanwhile update test results.

----
#### AI description  (iteration 1)
#### PR Classification
Code cleanup and enhancement.

#### PR Summary
This pull request declares and uses fixed versions of various packages to ensure consistency and reliability in the build environment.
- Updated `/oss/.devcontainer/Dockerfile` to declare and use fixed versions for multiple dependencies including PostgreSQL, Citus, libbson, PG_CRON, PG_VECTOR, Intel Decimal Math Library, PCRE2, and PostGIS.
- Modified `/.devcontainer/Dockerfile` to align with the fixed versioning approach and added necessary environment variables.
- Added `GetPostgresSourceRef` function in `oss/scripts/utils.sh` to map PostgreSQL versions to specific source references.
- Updated `oss/scripts/install_setup_intel_decimal_math_lib.sh` and `oss/scripts/install_setup_pcre2.sh` to accept version parameters.
- Moved several scripts from `/scripts` to `/oss/scripts` for better organization.

Related work items: #3571853
This commit is contained in:
Shuai Tian authored and Lusen Dong committed 2025-01-17 15:14:59 +08:00
1 parent abdb8f36b3
commit 30dcd6b5b8
13 files changed
+654 -37

No files matched your search

+81 -28
View File
@@ -5,13 +5,9 @@ ARG CITUS_VERSION=
# declare installed PG version and Citus version
ENV PG_VERSION=16
ENV CITUS_VERSION=12.1
ENV LC_ALL=en_US.UTF-8
ENV LANGUAGE=en_US
ENV LC_COLLATE=en_US.UTF-8
ENV LC_CTYPE=en_US.UTF-8
ENV CITUS_VERSION=12
# Install build essentials - Compiler, debugger, make, etc.
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get install -qy \
wget \
@@ -24,6 +20,21 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
pkg-config \
cmake \
git \
locales \
gcc \
gdb \
libipc-run-perl \
unzip \
apt-transport-https \
bison \
flex \
libreadline-dev \
zlib1g-dev \
libkrb5-dev \
software-properties-common \
libtool \
libicu-dev \
libssl-dev \
&& rm -rf /var/lib/apt/lists/*
# Add pgdg repo
@@ -32,36 +43,78 @@ RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg m
apt-get update && \
rm -rf /var/lib/apt/lists/*
RUN curl -4sSf https://packagecloud.io/install/repositories/citusdata/community/script.deb.sh | bash
RUN apt-get update && DEBIAN_FRONTEND=noninteractive \
&& apt-get install -y \
postgresql-${PG_VERSION} \
postgresql-server-dev-${PG_VERSION} \
libpq-dev \
libicu-dev \
libkrb5-dev \
postgresql-${PG_VERSION}-cron \
postgresql-${PG_VERSION}-pgvector \
postgresql-${PG_VERSION}-postgis-3 \
postgresql-${PG_VERSION}-rum \
postgresql-${PG_VERSION}-citus-${CITUS_VERSION} \
&& rm -rf /var/lib/apt/lists/*
# Install Libbson, decimal128, pcre
# Prepare for running install scripts
ENV CLEANUP_SETUP=1
ENV INSTALL_DEPENDENCIES_ROOT=/tmp/install_setup
RUN mkdir -p /tmp/install_setup
COPY scripts/ /tmp/install_setup
RUN MAKE_PROGRAM=cmake /tmp/install_setup/install_setup_libbson.sh
RUN /tmp/install_setup/install_setup_pcre2.sh
RUN /tmp/install_setup/install_setup_intel_decimal_math_lib.sh
RUN /tmp/install_setup/install_citus_indent.sh
# Copy setup_versions.sh which decides versions of the dependencies to install.
COPY scripts/setup_versions.sh /tmp/install_setup/
# Install libbson
COPY scripts/install_setup_libbson.sh /tmp/install_setup
RUN [ "bin/bash", "-c", "export MAKE_PROGRAM=cmake && /tmp/install_setup/install_setup_libbson.sh" ]
# Copy utils.sh
COPY scripts/utils.sh /tmp/install_setup/
# Install postgres
COPY scripts/install_setup_postgres.sh /tmp/install_setup/
RUN [ "bin/bash", "-c", "/tmp/install_setup/install_setup_postgres.sh -d \"/usr/lib/postgresql/${PG_VERSION}\" $POSTGRES_INSTALL_ARG -v ${PG_VERSION}" ]
# Install RUM from source
COPY scripts/install_setup_rum_oss.sh /tmp/install_setup/
RUN [ "bin/bash", "-c", "PGVERSION=$PG_VERSION /tmp/install_setup/install_setup_rum_oss.sh" ]
# Install citus
COPY scripts/install_setup_citus_core_oss.sh /tmp/install_setup/
RUN [ "bin/bash", "-c", "PGVERSION=$PG_VERSION /tmp/install_setup/install_setup_citus_core_oss.sh ${CITUS_VERSION}" ]
# Install citus-indent
COPY scripts/install_citus_indent.sh /tmp/install_setup/
RUN [ "bin/bash", "-c", "/tmp/install_setup/install_citus_indent.sh" ]
# Install SYSTEM_ROWS
COPY scripts/install_setup_system_rows.sh /tmp/install_setup/
RUN [ "bin/bash", "-c", "PGVERSION=$PG_VERSION /tmp/install_setup/install_setup_system_rows.sh" ]
# Install PG_CRON
COPY scripts/install_setup_pg_cron.sh /tmp/install_setup/
RUN [ "bin/bash", "-c", "PGVERSION=$PG_VERSION /tmp/install_setup/install_setup_pg_cron.sh" ]
# Download Decimal128 Intel library
COPY scripts/install_setup_intel_decimal_math_lib.sh /tmp/install_setup/
RUN [ "bin/bash", "-c", "/tmp/install_setup/install_setup_intel_decimal_math_lib.sh" ]
# Download PCRE2 library
COPY scripts/install_setup_pcre2.sh /tmp/install_setup/
RUN [ "bin/bash", "-c", "/tmp/install_setup/install_setup_pcre2.sh" ]
# Install PG_VECTOR
COPY scripts/install_setup_pgvector.sh /tmp/install_setup/
RUN [ "bin/bash", "-c", "PGVERSION=$PG_VERSION /tmp/install_setup/install_setup_pgvector.sh" ]
# Install PostGIS from source
RUN add-apt-repository -y ppa:ubuntugis/ppa && apt-get update && \
apt-get install -qy \
libproj-dev \
libxml2-dev \
libjson-c-dev \
libgeos++-dev libgeos-3.9.1 libgeos-c1v5 libgeos-dev \
&& rm -rf /var/lib/apt/lists/*
COPY scripts/install_setup_postgis.sh /tmp/install_setup/
RUN [ "bin/bash", "-c", "PGVERSION=$PG_VERSION /tmp/install_setup/install_setup_postgis.sh" ]
# Add postgre path to the PATH
ENV PATH=/usr/lib/postgresql/$PG_VERSION/bin:$PATH
# locale
RUN rm -rf /var/lib/apt/lists/* \
&& localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
ENV LANG en_US.utf8
# Create heliodb user
RUN useradd -ms /bin/bash heliodb -G sudo
RUN echo "%sudo ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers.d/no-pass-ask