Skip to content

Commit 397ae62

Browse files
authored
Merge branch 'master' into ihalatci-dependencies
2 parents e96ceb3 + 3c8dbc8 commit 397ae62

3 files changed

Lines changed: 46 additions & 7 deletions

File tree

circleci/images/Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ CITUS_UPGRADE_VERSIONS_17=v13.2.0
2626
# Function to get Citus versions for a specific PG major version
2727
get_citus_versions = $(CITUS_UPGRADE_VERSIONS_$(1))
2828

29+
# Function to get the last Citus version for a specific PG major version
30+
get_last_citus_version = $(lastword $(CITUS_UPGRADE_VERSIONS_$(1)))
31+
2932
# code below creates targets for all postgres versions in PG_VERSIONS
3033
define make-image-targets
3134
# $1 = PG_VERSION
@@ -52,12 +55,12 @@ push-all:: push-extbuilder-$1
5255
push-extbuilder-all:: push-extbuilder-$1
5356

5457
build-exttester-$1:
55-
docker build \
56-
exttester/ \
58+
docker build . \
5759
-f exttester/Dockerfile \
5860
--build-arg=PG_VERSION=$1 \
5961
--build-arg=PG_MAJOR=$2 \
6062
--build-arg=PG_VERSION_CLEAN=$3 \
63+
--build-arg=CITUS_VERSION="$(call get_last_citus_version,$2)" \
6164
--tag=${DOCKER_REPO}/exttester:$3${TAG_SUFFIX}
6265

6366
build-all:: build-exttester-$1

circleci/images/citusupgradetester/files/sbin/build-citus

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,9 @@ build_ext() {
5050

5151
cd "${installdir}" && find . -type f -print > "${builddir}/files.lst"
5252
tar cvf "${basedir}/install-pg${pg_major}-citus${citus_version}.tar" `cat ${builddir}/files.lst`
53-
54-
cd "${builddir}" && rm -rf install files.lst && make clean
53+
find usr/lib/postgresql/${pg_major}/lib -type f -name '*.so' -printf '%P\n' > "${builddir}/so-files.lst"
54+
tar cvf "${basedir}/so-pg${pg_major}-citus${citus_version}.tar" -C usr/lib/postgresql/${pg_major}/lib -T "${builddir}/so-files.lst"
55+
cd "${builddir}" && rm -rf install files.lst so-files.lst && make clean
5556
}
5657
for citus_version in ${CITUS_VERSIONS}
5758
do

circleci/images/exttester/Dockerfile

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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
5252
WORKDIR /build/postgresql-${PG_VERSION_CLEAN}/
53-
COPY patches/ patches/
53+
COPY exttester/patches/ patches/
5454
RUN <<'EOF'
5555
# apply postgres patches
5656

@@ -84,7 +84,7 @@ COPY --from=dev-tools-builder /build/postgresql-${PG_VERSION_CLEAN}/build/src/te
8484
COPY --from=dev-tools-builder /build/postgresql-${PG_VERSION_CLEAN}/src/test/regress/ usr/lib/postgresql/${PG_MAJOR}/lib/regress/
8585
RUN 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
9090
RUN useradd -ms /bin/bash circleci
@@ -137,13 +137,15 @@ ENV PATH="/root/.cargo/bin:${PATH}"
137137
RUN 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
141141
RUN locale-gen
142142

143143
ARG PG_VERSION
144144
ARG PG_MAJOR
145+
ARG CITUS_VERSION
145146
ENV PG_VERSION=$PG_VERSION
146147
ENV PG_MAJOR=$PG_MAJOR
148+
ENV CITUS_VERSION=$CITUS_VERSION
147149

148150
RUN <<'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
182184
RUN 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
185206
COPY --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+
187222
WORKDIR /home/circleci

0 commit comments

Comments
 (0)