forked from repo-mirrors/cnpg-postgres-containers
chore: add jit
package conditionally to standard images (#311)
Ensure recommended PostgreSQL packages are included in the `standard` image only when required by the version. Starting with PostgreSQL 18, the PGDG Debian packages split `jit` into its own package, so it needs to be added separately. Closes #288 Signed-off-by: Gabriele Bartolini <gabriele.bartolini@enterprisedb.com> Signed-off-by: Niccolò Fei <niccolo.fei@enterprisedb.com> Co-authored-by: Niccolò Fei <niccolo.fei@enterprisedb.com>
This commit is contained in:
committed by
GitHub
parent
796423b54a
commit
2d1054c8f0
@@ -22,9 +22,10 @@ USER 26
|
|||||||
|
|
||||||
FROM minimal AS standard
|
FROM minimal AS standard
|
||||||
ARG EXTENSIONS
|
ARG EXTENSIONS
|
||||||
|
ARG STANDARD_ADDITIONAL_POSTGRES_PACKAGES
|
||||||
USER root
|
USER root
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get install -y --no-install-recommends locales-all ${EXTENSIONS} && \
|
apt-get install -y --no-install-recommends locales-all ${STANDARD_ADDITIONAL_POSTGRES_PACKAGES} ${EXTENSIONS} && \
|
||||||
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false && \
|
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false && \
|
||||||
rm -rf /var/lib/apt/lists/* /var/cache/* /var/log/*
|
rm -rf /var/lib/apt/lists/* /var/cache/* /var/log/*
|
||||||
|
|
||||||
|
@@ -40,6 +40,7 @@ postgreSQLPreviewVersions = [
|
|||||||
# renovate: datasource=github-releases depName=EnterpriseDB/barman versioning=loose
|
# renovate: datasource=github-releases depName=EnterpriseDB/barman versioning=loose
|
||||||
barmanVersion = "3.14.0"
|
barmanVersion = "3.14.0"
|
||||||
|
|
||||||
|
// Extensions to be included in the `standard` image
|
||||||
extensions = [
|
extensions = [
|
||||||
"pgaudit",
|
"pgaudit",
|
||||||
"pgvector",
|
"pgvector",
|
||||||
@@ -82,6 +83,7 @@ target "default" {
|
|||||||
PG_MAJOR = "${getMajor(pgVersion)}"
|
PG_MAJOR = "${getMajor(pgVersion)}"
|
||||||
BASE = "${base}"
|
BASE = "${base}"
|
||||||
EXTENSIONS = "${getExtensionsString(pgVersion, extensions)}"
|
EXTENSIONS = "${getExtensionsString(pgVersion, extensions)}"
|
||||||
|
STANDARD_ADDITIONAL_POSTGRES_PACKAGES = "${getStandardAdditionalPostgresPackagesPerMajorVersion(getMajor(pgVersion))}"
|
||||||
BARMAN_VERSION = "${barmanVersion}"
|
BARMAN_VERSION = "${barmanVersion}"
|
||||||
}
|
}
|
||||||
attest = [
|
attest = [
|
||||||
@@ -155,6 +157,17 @@ function getExtensionsString {
|
|||||||
result = (isPreview(version) == true) ? "" : join(" ", formatlist("postgresql-%s-%s", getMajor(version), extensions))
|
result = (isPreview(version) == true) ? "" : join(" ", formatlist("postgresql-%s-%s", getMajor(version), extensions))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This function conditionally adds recommended PostgreSQL packages based on
|
||||||
|
// the version. For example, starting with version 18, PGDG moved `jit` out of
|
||||||
|
// the main package and into a separate one.
|
||||||
|
function getStandardAdditionalPostgresPackagesPerMajorVersion {
|
||||||
|
params = [ majorVersion ]
|
||||||
|
// Add PostgreSQL jit package from version 18
|
||||||
|
result = join(" ", [
|
||||||
|
majorVersion < 18 ? "" : format("postgresql-%s-jit", majorVersion)
|
||||||
|
])
|
||||||
|
}
|
||||||
|
|
||||||
function isMajorPresent {
|
function isMajorPresent {
|
||||||
params = [major, pgVersions]
|
params = [major, pgVersions]
|
||||||
result = contains([for v in pgVersions : getMajor(v)], major)
|
result = contains([for v in pgVersions : getMajor(v)], major)
|
||||||
|
Reference in New Issue
Block a user