Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip PostgreSQL 12 by default for CICD #784

Merged
merged 4 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
fail-fast: false
max-parallel: 12
matrix:
pgversion: [12, 13, 14, 15, 16]
pgversion: [13, 14, 15, 16]
container:
- os: rockylinux
version: "9"
Expand Down Expand Up @@ -80,6 +80,17 @@ jobs:
os: centos
version: "7"
pgversion: 16
# TimescaleDB as of 2.12.0 no longer supports PostgreSQL 12.
# To allow us to do run CI against PostgreSQL 12, we therefore explicitly
# remove all CI's, except if we are run against the latest supported TimescaleDB
# version for PostgreSQL 12, which is 2.11.2
include:
- pgversion: 12
container:
image: debian-11-amd64
os: debian
version: "11"
tsdb_commit: 2.11.2
env:
# TODO Why? Cargo default is to pass `-C incremental` to rustc; why don't we want that?
# https://doc.rust-lang.org/rustc/codegen-options/index.html#incremental
Expand Down Expand Up @@ -113,7 +124,7 @@ jobs:

- name: Build and install TimescaleDB
if: ${{ (github.event_name == 'schedule' && github.event.schedule == '0 8 * * 1-4') || inputs.tsdb-commit != '' }}
run: ./tools/install-timescaledb '${{ matrix.pgversion }}' '${{ inputs.tsdb-repo || 'https://github.com/timescale/timescaledb.git' }}' '${{ inputs.tsdb-commit == '' && 'main' || inputs.tsdb-commit }}'
run: ./tools/install-timescaledb '${{ matrix.pgversion }}' '${{ matrix.tsdb_commit || inputs.tsdb-repo || 'https://github.com/timescale/timescaledb.git' }}' '${{ inputs.tsdb-commit == '' && 'main' || matrix.tsdb_commit || inputs.tsdb-commit }}'

# TODO After the container image contains a primed target dir, is this still worth it?
# Only possible advantage is this one is per-pg-version but what's the impact?
Expand Down
68 changes: 41 additions & 27 deletions docker/ci/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ if $privileged; then
centos | rockylinux)
case $OS_VERSION in
7)
export PG_VERSIONS="13 14 15"
export TSDB_PG_VERSIONS="13 14 15"
# Postgresql packages require both
# - llvm-toolset-7-clang from centos-release-scl-rh
# - llvm5.0-devel from epel-release
Expand Down Expand Up @@ -147,6 +149,11 @@ EOF

# Debian family
debian | ubuntu)
# TimescaleDB does not have packages for Debian 12
if [ $OS_VERSION -ge 12 ]; then
export TSDB_PG_VERSIONS="13 14 15"
fi

# Image comes in with no package lists so we have to start with this.
apt-get -qq update

Expand Down Expand Up @@ -197,28 +204,28 @@ EOF

apt-get -qq update

for pg in $PG_VERSIONS; do
apt-get -qq install \
postgresql-$pg \
postgresql-server-dev-$pg
# We install as user postgres, so that needs write access to these.
chown $BUILDER_USERNAME $PG_BASE$pg/lib /usr/share/postgresql/$pg/extension
done

for pg in $TSDB_PG_VERSIONS; do
# timescaledb packages Recommend toolkit, which we don't want here.
apt-get -qq install --no-install-recommends timescaledb-2-postgresql-$pg
done

# Ubuntu is the only system we want an image for that sticks an extra
# copy of the default PATH into PAM's /etc/environment and we su or sudo
# to $BUILDER_USERNAME thereby picking up that PATH and clobbering the
# one we set in Dockerfile. There's nothing else in here, so at first I
# thought to remove it. That works on 20.04 and 22.04, but still leaves
# a busted PATH on 18.04! On 18.04, we get clobbered by ENV_PATH in
# /etc/login.defs . We fix all three by setting our PATH here:
echo > /etc/environment "PATH=$PATH"
;;
for pg in $PG_VERSIONS; do
apt-get -qq install \
postgresql-$pg \
postgresql-server-dev-$pg
# We install as user postgres, so that needs write access to these.
chown $BUILDER_USERNAME $PG_BASE$pg/lib /usr/share/postgresql/$pg/extension
done

for pg in $TSDB_PG_VERSIONS; do
# timescaledb packages Recommend toolkit, which we don't want here.
apt-get -qq install --no-install-recommends timescaledb-2-postgresql-$pg
done

# Ubuntu is the only system we want an image for that sticks an extra
# copy of the default PATH into PAM's /etc/environment and we su or sudo
# to $BUILDER_USERNAME thereby picking up that PATH and clobbering the
# one we set in Dockerfile. There's nothing else in here, so at first I
# thought to remove it. That works on 20.04 and 22.04, but still leaves
# a busted PATH on 18.04! On 18.04, we get clobbered by ENV_PATH in
# /etc/login.defs . We fix all three by setting our PATH here:
echo > /etc/environment "PATH=$PATH"
;;
esac

# Phase 3 - cross-platform privileged tasks after package installation
Expand All @@ -245,13 +252,20 @@ cargo install cargo-pgrx --version =$PGRX_VERSION

# Configure pgrx
## `cargo pgrx init` is not additive; must specify all versions in one command.
for pg in $PG_VERSIONS; do
init_flags="$init_flags --pg$pg $PG_BASE$pg/bin/pg_config"
for pg_config in $(find /usr -name 'pg_config' -type f | grep "${PG_BASE}"); do
pg="$(${pg_config} --version | awk -F '[ .]' '{print $2'})"
init_flags="$init_flags --pg$pg ${pg_config}"
done
cargo pgrx init $init_flags
## Initialize pgrx-managed databases so we can add the timescaledb load.
for pg in $TSDB_PG_VERSIONS; do
echo "shared_preload_libraries = 'timescaledb'" >> ~/.pgrx/data-$pg/postgresql.conf

## Initialize pgrx-managed databases so we can add the timescaledb load, but only
## for those PostgreSQL versions that have the timescaledb.so library available.
for pg_config in $(find /usr -name 'pg_config' -type f | grep "${PG_BASE}"); do
pg="$(${pg_config} --version | awk -F '[ .]' '{print $2'})"
lib="$(find "${PG_BASE}${pg}" -type f -name 'timescaledb.so')"
if [ "${lib}" != "" ]; then
echo "shared_preload_libraries = 'timescaledb'" >> ~/.pgrx/data-$pg/postgresql.conf
fi
done

# Clone and fetch dependencies so we builds have less work to do.
Expand Down