Skip to content

Commit

Permalink
Update pgaudit and other six other extensions (#864)
Browse files Browse the repository at this point in the history
Update the following extension build scripts, build from PGXN where
possible, and upgrade the versions:

*   pg_text_semver v1.2.1
*   pg_timeit at specific commit
*   pg_tle v1.2.0
*   pg_track_settings
*   pg_uuidv7 v1.6.0
*   pg_wait_sampling v1.1.6

Add separate build configurations for pgaudit, which has different
versions for different major Postgres releases, but keep the extension
name the same. Teach the extensions workflow not to build it on the
wrong major versions, just like with pg_hint_plan.
  • Loading branch information
theory committed Dec 18, 2024
1 parent 445a034 commit e19ed3c
Show file tree
Hide file tree
Showing 23 changed files with 190 additions and 148 deletions.
24 changes: 21 additions & 3 deletions .github/workflows/extensions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,14 @@ jobs:
ext: ${{ fromJson(needs.find_directories.outputs.directories).include }}
pg: [15]
exclude:
# pg_hint_plabn has separate extensions for each major version
# pg_hint_plan has separate extensions for each major version
- { ext: { name: pg_hint_plan14 } }
- { ext: { name: pg_hint_plan16 } }
- { ext: { name: pg_hint_plan17 } }
# pgaudit has separate configs for each major version
- { ext: { name: pgaudit14 } }
- { ext: { name: pgaudit16 } }
- { ext: { name: pgaudit17 } }
steps:
- uses: actions/checkout@v4
- name: Install system dependencies
Expand Down Expand Up @@ -98,11 +102,12 @@ jobs:
ext: ${{ fromJson(needs.find_directories.outputs.directories).include }}
pg: [17, 16, 15, 14]
exclude:
- { pg: 14, ext: { name: pg_walinspect } } # Added in Postgres 17
- { pg: 17, ext: { name: adminpack } } # Removed from Postgres 17
- { pg: 17, ext: { name: old_snapshot } } # Removed from Postgres 17
- { pg: 17, ext: { name: pg_lakehouse } } # Renamed pg_analytics
- { pg: 17, ext: { name: pg_sparse } } # Removed after v0.7.0
# pg_hint_plabn has separate extensions for each major version
# pg_hint_plan has separate extensions for each major version
- { pg: 17, ext: { name: pg_hint_plan14 } }
- { pg: 17, ext: { name: pg_hint_plan15 } }
- { pg: 17, ext: { name: pg_hint_plan16 } }
Expand All @@ -115,6 +120,19 @@ jobs:
- { pg: 14, ext: { name: pg_hint_plan15 } }
- { pg: 14, ext: { name: pg_hint_plan16 } }
- { pg: 14, ext: { name: pg_hint_plan17 } }
# pgaudit has separate configs for each major version
- { pg: 17, ext: { name: pgaudit14 } }
- { pg: 17, ext: { name: pgaudit15 } }
- { pg: 17, ext: { name: pgaudit16 } }
- { pg: 16, ext: { name: pgaudit14 } }
- { pg: 16, ext: { name: pgaudit15 } }
- { pg: 16, ext: { name: pgaudit17 } }
- { pg: 15, ext: { name: pgaudit14 } }
- { pg: 15, ext: { name: pgaudit16 } }
- { pg: 15, ext: { name: pgaudit17 } }
- { pg: 14, ext: { name: pgaudit15 } }
- { pg: 14, ext: { name: pgaudit16 } }
- { pg: 14, ext: { name: pgaudit17 } }
env:
TRUNK_API_TOKEN: ${{ secrets.TRUNK_AUTH_TOKEN }}
PGHOST: "localhost"
Expand Down Expand Up @@ -142,7 +160,7 @@ jobs:
if: matrix.pg == 15
shell: bash -e {0}
run: |
for val in pg_cron timescaledb pg_search pg_analytics citus plrust pg_net pg_stat_kcache pg_squeeze; do
for val in pg_cron timescaledb pg_search pg_analytics citus plrust pg_net pg_stat_kcache pg_squeeze pg_tle pgaudit; do
if [[ "${{ matrix.ext.path }}" == *"$val"* ]]; then
echo handling shared_preload_libraries for $val
echo "shared_preload_libraries = '$val'" >> /var/lib/postgresql/data2/postgresql.conf
Expand Down
20 changes: 8 additions & 12 deletions contrib/pg_text_semver/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
# Set PostgreSQL version
ARG PG_VERSION=15
ARG PG_VERSION
FROM quay.io/coredb/c-builder:pg${PG_VERSION}

# Clone repository
RUN git clone https://github.com/bigsmoke/pg_text_semver.git

# Set project version
ARG RELEASE=v0.1.4

# Build extension
RUN cd pg_text_semver && \
git fetch origin ${RELEASE} && \
git checkout ${RELEASE} && \
make
# Extension build dependencies
ARG EXTENSION_NAME
ARG EXTENSION_VERSION
RUN curl -O https://api.pgxn.org/dist/${EXTENSION_NAME}/${EXTENSION_VERSION}/${EXTENSION_NAME}-${EXTENSION_VERSION}.zip \
&& unzip ${EXTENSION_NAME}-${EXTENSION_VERSION}.zip \
&& cd ${EXTENSION_NAME}-${EXTENSION_VERSION} && make
WORKDIR /app/${EXTENSION_NAME}-${EXTENSION_VERSION}
11 changes: 3 additions & 8 deletions contrib/pg_text_semver/Trunk.toml
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
[extension]
name = "pg_text_semver"
version = "0.1.4"
version = "1.2.1"
repository = "https://github.com/bigsmoke/pg_text_semver"
license = "Copyright"
description = "PostgreSQL semantic versioning extension, with comparison functions and operators."
documentation = "https://github.com/bigsmoke/pg_text_semver"
categories = ["data_transformations"]

[build]
postgres_version = "15"
postgres_version = "17"
platform = "linux/amd64"
dockerfile = "Dockerfile"
install_command = """
cd pg_text_semver && make install
set -x
mv /usr/local/pgsql/share/extension/* /usr/share/postgresql/15/extension
mv /usr/local/pgsql/lib/* /usr/lib/postgresql/15/lib
"""
install_command = "make install"
15 changes: 9 additions & 6 deletions contrib/pg_timeit/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
ARG PG_VERSION=15
ARG PG_VERSION
FROM quay.io/coredb/c-builder:pg${PG_VERSION}

# Clone repository
RUN git clone https://github.com/joelonsql/pg-timeit.git

RUN cd pg-timeit && \
make
# Clone and build the extension.
# ARG EXTENSION_NAME
# ARG EXTENSION_VERSION
ARG RELEASE=d83ab65
RUN git clone https://github.com/joelonsql/pg-timeit.git \
&& cd pg-timeit \
&& git checkout ${RELEASE} \
&& make
9 changes: 2 additions & 7 deletions contrib/pg_timeit/Trunk.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,7 @@ categories = ["metrics"]
apt = ["libc6"]

[build]
postgres_version = "15"
postgres_version = "17"
platform = "linux/amd64"
dockerfile = "Dockerfile"
install_command = """
cd pg-timeit && make install
set -x
mv /usr/local/pgsql/share/extension/* /usr/share/postgresql/15/extension
mv /usr/local/pgsql/lib/* /usr/lib/postgresql/15/lib
"""
install_command = "make -C pg-timeit install"
18 changes: 9 additions & 9 deletions contrib/pg_tle/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
ARG PG_VERSION=15
ARG PG_VERSION
FROM quay.io/coredb/c-builder:pg${PG_VERSION}

# Clone repository
RUN git clone https://github.com/aws/pg_tle.git
# Extension build dependencies
USER root
RUN apt-get update && apt-get install -y libkrb5-dev

ARG RELEASE=v1.0.4

RUN cd pg_tle && \
git fetch origin ${RELEASE} && \
git checkout ${RELEASE} && \
make
# Clone and build the extension.
ARG EXTENSION_NAME
ARG EXTENSION_VERSION
RUN git clone --depth 1 --branch "v${EXTENSION_VERSION}" https://github.com/aws/${EXTENSION_NAME}.git \
&& make -C ${EXTENSION_NAME}
12 changes: 3 additions & 9 deletions contrib/pg_tle/Trunk.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[extension]
name = "pg_tle"
version = "1.0.4"
version = "1.2.0"
repository = "https://github.com/aws/pg_tle"
license = "Apache-2.0"
description = "Framework for building trusted language extensions for PostgreSQL."
Expand All @@ -13,13 +13,7 @@ preload_libraries = ["pg_tle"]
apt = ["libc6"]

[build]
postgres_version = "15"
postgres_version = "17"
platform = "linux/amd64"
dockerfile = "Dockerfile"
install_command = """
cd pg_tle && make install
set -x
mv /usr/local/pgsql/share/extension/* /usr/share/postgresql/15/extension
mv /usr/local/pgsql/lib/* /usr/lib/postgresql/15/lib
"""

install_command = "make -C pg_tle install"
20 changes: 8 additions & 12 deletions contrib/pg_track_settings/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
# Set PostgreSQL version
ARG PG_VERSION=15
ARG PG_VERSION
FROM quay.io/coredb/c-builder:pg${PG_VERSION}

# Clone repository
RUN git clone https://github.com/rjuju/pg_track_settings.git

# Set project version
ARG RELEASE=2.1.2

# Build extension
RUN cd pg_track_settings && \
git fetch origin ${RELEASE} && \
git checkout ${RELEASE} && \
make
# Extension build dependencies
ARG EXTENSION_NAME
ARG EXTENSION_VERSION
RUN curl -O https://api.pgxn.org/dist/${EXTENSION_NAME}/${EXTENSION_VERSION}/${EXTENSION_NAME}-${EXTENSION_VERSION}.zip \
&& unzip ${EXTENSION_NAME}-${EXTENSION_VERSION}.zip \
&& cd ${EXTENSION_NAME}-${EXTENSION_VERSION} && make
WORKDIR /app/${EXTENSION_NAME}-${EXTENSION_VERSION}
9 changes: 2 additions & 7 deletions contrib/pg_track_settings/Trunk.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,7 @@ documentation = "https://github.com/rjuju/pg_track_settings"
categories = ["auditing_logging"]

[build]
postgres_version = "15"
postgres_version = "17"
platform = "linux/amd64"
dockerfile = "Dockerfile"
install_command = """
cd pg_track_settings && make install
set -x
mv /usr/local/pgsql/share/extension/* /usr/share/postgresql/15/extension
mv /usr/local/pgsql/lib/* /usr/lib/postgresql/15/lib
"""
install_command = "make install"
19 changes: 9 additions & 10 deletions contrib/pg_uuidv7/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
ARG PG_VERSION=15
# Set PostgreSQL version
ARG PG_VERSION
FROM quay.io/coredb/c-builder:pg${PG_VERSION}

# Clone repository
RUN git clone https://github.com/fboulnois/pg_uuidv7.git

ARG RELEASE=v1.0.2

RUN cd pg_uuidv7 && \
git fetch origin ${RELEASE} && \
git checkout ${RELEASE} && \
make
# Extension build dependencies
ARG EXTENSION_NAME
ARG EXTENSION_VERSION
RUN curl -O https://api.pgxn.org/dist/${EXTENSION_NAME}/${EXTENSION_VERSION}/${EXTENSION_NAME}-${EXTENSION_VERSION}.zip \
&& unzip ${EXTENSION_NAME}-${EXTENSION_VERSION}.zip \
&& cd ${EXTENSION_NAME}-${EXTENSION_VERSION} && make
WORKDIR /app/${EXTENSION_NAME}-${EXTENSION_VERSION}
9 changes: 2 additions & 7 deletions contrib/pg_uuidv7/Trunk.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[extension]
name = "pg_uuidv7"
version = "1.0.0"
version = "1.6.0"
repository = "https://github.com/fboulnois/pg_uuidv7"
license = "MPL-2.0"
description = "Create valid version 7 UUIDs in Postgres."
Expand All @@ -15,9 +15,4 @@ apt = ["libc6"]
postgres_version = "15"
platform = "linux/amd64"
dockerfile = "Dockerfile"
install_command = """
cd pg_uuidv7 && make install
set -x
mv /usr/local/pgsql/share/extension/* /usr/share/postgresql/15/extension
mv /usr/local/pgsql/lib/* /usr/lib/postgresql/15/lib
"""
install_command = "make install"
18 changes: 6 additions & 12 deletions contrib/pg_wait_sampling/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
# Set PostgreSQL version
ARG PG_VERSION=15
ARG PG_VERSION
FROM quay.io/coredb/c-builder:pg${PG_VERSION}

# Clone repository
RUN git clone https://github.com/postgrespro/pg_wait_sampling.git

# Set project version
ARG RELEASE=v1.1.4

# Build extension
RUN cd pg_wait_sampling && \
git fetch origin ${RELEASE} && \
git checkout ${RELEASE} && \
make USE_PGXS=1
# Clone and build the extension.
ARG EXTENSION_NAME
ARG EXTENSION_VERSION
RUN git clone --depth 1 --branch "v${EXTENSION_VERSION}" https://github.com/postgrespro/${EXTENSION_NAME}.git \
&& make -C ${EXTENSION_NAME} USE_PGXS=1
11 changes: 3 additions & 8 deletions contrib/pg_wait_sampling/Trunk.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[extension]
name = "pg_wait_sampling"
version = "1.1.0"
version = "1.1.6"
repository = "https://github.com/postgrespro/pg_wait_sampling"
license = "PostgreSQL"
description = "Sampling based statistics of wait events."
Expand All @@ -12,12 +12,7 @@ preload_libraries = ["pg_wait_sampling"]
apt = ["libc6"]

[build]
postgres_version = "15"
postgres_version = "17"
platform = "linux/amd64"
dockerfile = "Dockerfile"
install_command = """
cd pg_wait_sampling && make USE_PGXS=1 install
set -x
mv /usr/local/pgsql/share/extension/* /usr/share/postgresql/15/extension
mv /usr/local/pgsql/lib/* /usr/lib/postgresql/15/lib
"""
install_command = "make -C pg_wait_sampling USE_PGXS=1 install"
1 change: 0 additions & 1 deletion contrib/pg_walinspect/Trunk.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ homepage = "https://www.postgresql.org"
documentation = "https://www.postgresql.org/docs/current/pgwalinspect.html"
categories = ["metrics"]


[dependencies]
apt = ["libc6"]

Expand Down
31 changes: 0 additions & 31 deletions contrib/pgaudit/Dockerfile

This file was deleted.

12 changes: 12 additions & 0 deletions contrib/pgaudit14/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
ARG PG_VERSION
FROM quay.io/coredb/c-builder:pg${PG_VERSION}

# Extension build dependencies
USER root
RUN apt-get update && apt-get install -y libkrb5-dev

# Clone and build the extension.
ARG EXTENSION_NAME
ARG EXTENSION_VERSION
RUN git clone --depth 1 --branch "${EXTENSION_VERSION}" https://github.com/${EXTENSION_NAME}/${EXTENSION_NAME}.git \
&& make -C ${EXTENSION_NAME} USE_PGXS=1
18 changes: 18 additions & 0 deletions contrib/pgaudit14/Trunk.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[extension]
name = "pgaudit"
version = "1.6.2"
repository = "https://github.com/pgaudit/pgaudit"
license = "PostgreSQL"
description = "The PostgreSQL Audit Extension (pgAudit) provides detailed session and/or object audit logging via the standard PostgreSQL logging facility."
homepage = "https://www.pgaudit.org/"
documentation = "https://github.com/pgaudit/pgaudit/blob/master/README.md"
categories = ["auditing_logging"]

[dependencies]
apt = ["libc6"]

[build]
postgres_version = "14"
platform = "linux/amd64"
dockerfile = "Dockerfile"
install_command = "make -C pgaudit USE_PGXS=1 install"
12 changes: 12 additions & 0 deletions contrib/pgaudit15/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
ARG PG_VERSION
FROM quay.io/coredb/c-builder:pg${PG_VERSION}

# Extension build dependencies
USER root
RUN apt-get update && apt-get install -y libkrb5-dev

# Clone and build the extension.
ARG EXTENSION_NAME
ARG EXTENSION_VERSION
RUN git clone --depth 1 --branch "${EXTENSION_VERSION}" https://github.com/${EXTENSION_NAME}/${EXTENSION_NAME}.git \
&& make -C ${EXTENSION_NAME} USE_PGXS=1
Loading

0 comments on commit e19ed3c

Please sign in to comment.