From a3a006ced2dcc8ff301fb31c3611671710132d91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niccol=C3=B2=20Fei?= Date: Tue, 9 Sep 2025 12:21:04 +0200 Subject: [PATCH] chore: re-enable build of preview versions (#296) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #294 Signed-off-by: Niccolò Fei Signed-off-by: Gabriele Bartolini Co-authored-by: Gabriele Bartolini --- BUILD.md | 31 +++++++++++++++++++++++++++++++ README.md | 22 ++++++++++++++++------ docker-bake.hcl | 34 +++++++++++++++++++++++++++++----- 3 files changed, 76 insertions(+), 11 deletions(-) diff --git a/BUILD.md b/BUILD.md index d83e6e04..e22c9bfa 100644 --- a/BUILD.md +++ b/BUILD.md @@ -129,6 +129,37 @@ based on their digest through a GitHub workflow, using the [`cosign-installer` action](https://github.com/marketplace/actions/cosign-installer), which leverages [short-lived tokens issued through OpenID Connect](https://docs.github.com/en/actions/security-for-github-actions/security-hardening-your-deployments/about-security-hardening-with-openid-connect). +## PostgreSQL Preview Versions + +PostgreSQL delivers a new major release every year. Before the stable version +is published, preview builds are made available in the form of beta releases +(e.g. `beta1`) and one or more release candidates (e.g. `rc1`). + +Once the first beta of a new major release is published as a Debian package, +you can start building preview images by updating the +`postgreSQLPreviewVersions` array in the `docker-bake.hcl` file. For example: + +```yaml +postgreSQLPreviewVersions = [ + "19~beta1", +] +``` + +**NOTE:** Always use the Debian package naming convention when specifying +preview versions (e.g. `19~beta1`, `19~rc1`). + +To confirm that version 19 is included in the build process, run: + +```bash +docker buildx bake --print +``` + +**IMPORTANT:** Versions listed in `postgreSQLPreviewVersions` are automatically +excluded if the same version is already available as a stable release in the +`postgreSQLVersions` array. Although this safeguard prevents duplication, the +`postgreSQLPreviewVersions` array should be cleared once a preview version is +promoted to stable (e.g. when `19~rc1` becomes `19.0`). + ## Trademarks *[Postgres, PostgreSQL and the Slonik Logo](https://www.postgresql.org/about/policies/trademarks/) diff --git a/README.md b/README.md index 653da7ae..68d29c12 100644 --- a/README.md +++ b/README.md @@ -12,13 +12,23 @@ # CNPG PostgreSQL Container Images -This repository provides maintenance scripts for generating **immutable -application containers** for all supported PostgreSQL versions (13 to 17), -as well as for PostgreSQL 18 beta. +This repository provides maintenance scripts for generating +**immutable application containers** for all supported +[PostgreSQL major versions](https://www.postgresql.org/support/versioning/): -These containers are designed to serve as **operands** for the -[CloudNativePG (CNPG) operator](https://cloudnative-pg.io) -within Kubernetes environments. +| Version | Release Date | EOL | +|:-------:|:------------:|:----------:| +| 17 | 2024-09-26 | 2029-11-08 | +| 16 | 2023-09-14 | 2028-11-09 | +| 15 | 2022-10-13 | 2027-11-11 | +| 14 | 2021-09-30 | 2026-11-12 | +| 13 | 2020-09-24 | 2025-11-13 | + +In addition, PostgreSQL 18 RC1 is provided for testing purposes only. + +These images are designed to serve as operands of the +[CloudNativePG (CNPG) operator](https://cloudnative-pg.io) in Kubernetes +environments, and are not intended for standalone use. ## Key Features diff --git a/docker-bake.hcl b/docker-bake.hcl index 4ed5790e..372424a3 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -29,6 +29,13 @@ postgreSQLVersions = [ "17.6" ] +// PostgreSQL preview versions to build, such as "18~beta1" or "18~rc1" +// Preview versions are automatically filtered out if present in the stable list +// MANUALLY EDIT THE CONTENT - AND UPDATE THE README.md FILE TOO +postgreSQLPreviewVersions = [ + "18~rc1", +] + // Barman version to build # renovate: datasource=github-releases depName=EnterpriseDB/barman versioning=loose barmanVersion = "3.14.0" @@ -46,7 +53,8 @@ target "default" { "standard", "system" ] - pgVersion = postgreSQLVersions + // Get the list of PostgreSQL versions, filtering preview versions if already stable + pgVersion = getPgVersions(postgreSQLVersions, postgreSQLPreviewVersions) base = [ // renovate: datasource=docker versioning=loose "debian:trixie-slim@sha256:c85a2732e97694ea77237c61304b3bb410e0e961dd6ee945997a06c788c545bb", @@ -132,17 +140,33 @@ function cleanVersion { result = replace(version, "~", "") } -function isBeta { +function isPreview { params = [ version ] - result = length(regexall("[0-9]+~beta.*", version)) > 0 + result = length(regexall("[0-9]+~(alpha|beta|rc).*", version)) > 0 } function getMajor { params = [ version ] - result = (isBeta(version) == true) ? index(split("~", version),0) : index(split(".", version),0) + result = (isPreview(version) == true) ? index(split("~", version),0) : index(split(".", version),0) } function getExtensionsString { params = [ version, extensions ] - result = (isBeta(version) == true) ? "" : join(" ", formatlist("postgresql-%s-%s", getMajor(version), extensions)) + result = (isPreview(version) == true) ? "" : join(" ", formatlist("postgresql-%s-%s", getMajor(version), extensions)) +} + +function isMajorPresent { + params = [major, pgVersions] + result = contains([for v in pgVersions : getMajor(v)], major) +} + +function getPgVersions { + params = [stableVersions, previewVersions] + // Remove any preview version if already present as stable + result = concat(stableVersions, + [ + for v in previewVersions : v + if !isMajorPresent(getMajor(v), stableVersions) + ] + ) }