@@ -50,7 +50,7 @@ RUN tar jxf "postgresql-${PG_VERSION_CLEAN}.tar.bz2"
5050
5151# apply optional patches that might be required for a successful testsuite
5252WORKDIR /build/postgresql-${PG_VERSION_CLEAN}/
53- COPY patches/ patches/
53+ COPY exttester/ patches/ patches/
5454RUN <<'EOF'
5555# apply postgres patches
5656
@@ -84,7 +84,7 @@ COPY --from=dev-tools-builder /build/postgresql-${PG_VERSION_CLEAN}/build/src/te
8484COPY --from=dev-tools-builder /build/postgresql-${PG_VERSION_CLEAN}/src/test/regress/ usr/lib/postgresql/${PG_MAJOR}/lib/regress/
8585RUN rm -rf usr/lib/postgresql/${PG_MAJOR}/lib/regress/*.c usr/lib/postgresql/${PG_MAJOR}/lib/regress/*.h
8686
87- FROM buildpack-deps:bookworm
87+ FROM buildpack-deps:bookworm AS setup-environment
8888
8989# add unpriviliged user for tests
9090RUN useradd -ms /bin/bash circleci
@@ -137,13 +137,15 @@ ENV PATH="/root/.cargo/bin:${PATH}"
137137RUN cpanm install IPC::Run
138138
139139# make special locales available
140- COPY locale.gen /etc/locale.gen
140+ COPY exttester/ locale.gen /etc/locale.gen
141141RUN locale-gen
142142
143143ARG PG_VERSION
144144ARG PG_MAJOR
145+ ARG CITUS_VERSION
145146ENV PG_VERSION=$PG_VERSION
146147ENV PG_MAJOR=$PG_MAJOR
148+ ENV CITUS_VERSION=$CITUS_VERSION
147149
148150RUN <<'EOF'
149151# install postgres ecosystem for pg version: $PG_VERSION
@@ -181,7 +183,40 @@ ENV PATH=/usr/lib/postgresql/$PG_MAJOR/bin/:$PATH
181183# setup /var/run/postgresql for use with circleci
182184RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql && chmod 2777 /var/run/postgresql
183185
186+
187+ FROM setup-environment AS build-citus
188+
189+ ENV CITUS_VERSIONS=$CITUS_VERSION
190+
191+ WORKDIR /build-citus/
192+ COPY citusupgradetester/files/sbin/build-citus .
193+ RUN if [ -n "${CITUS_VERSION}" ]; then ./build-citus; else echo "Skipping citus build - CITUS_VERSION not set" ; fi
194+
195+
196+ FROM setup-environment
197+
198+ ARG CITUS_VERSION
199+ ARG PG_VERSION
200+ ARG PG_MAJOR
201+ ENV CITUS_VERSION=$CITUS_VERSION
202+ ENV PG_MAJOR=$PG_MAJOR
203+ ENV PG_VERSION=$PG_VERSION
204+
184205# copy the collected files from the collection container at once into the final container
185206COPY --from=dev-tools-collection /collect/ /
186207
208+ # copy citus so files from the build-citus stage
209+ COPY --from=build-citus /build-citus/ /tmp/build-citus/
210+
211+ # Extract conditionally in shell
212+ RUN <<'EOF'
213+ set -eux
214+ if [ -n "${CITUS_VERSION}" ] && [ -f "/tmp/build-citus/so-pg${PG_MAJOR}-citus${CITUS_VERSION}.tar" ]; then
215+ mkdir -p /opt/citus-versions/${CITUS_VERSION}
216+ cd /opt/citus-versions/${CITUS_VERSION}
217+ tar xvf /tmp/build-citus/so-pg${PG_MAJOR}-citus${CITUS_VERSION}.tar
218+ fi
219+ EOF
220+ RUN rm -rf /tmp/build-citus/
221+
187222WORKDIR /home/circleci
0 commit comments