Skip to content

Commit f097385

Browse files
chore: migrate rolling tags to bake system images (#297)
Closes #284 Closes #285 Signed-off-by: Niccolò Fei <niccolo.fei@enterprisedb.com> Signed-off-by: Gabriele Bartolini <gabriele.bartolini@enterprisedb.com> Co-authored-by: Gabriele Bartolini <gabriele.bartolini@enterprisedb.com>
1 parent a3a006c commit f097385

2 files changed

Lines changed: 62 additions & 3 deletions

File tree

README.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,57 @@ and include Barman Cloud binaries.
118118
> should plan to migrate to either a `minimal` or `standard` image together
119119
> with the Barman Cloud plugin—or adopt another supported backup solution.
120120
121+
## Image Tags
122+
123+
Each image is identified by its digest and a main tag of the form:
124+
125+
```
126+
MM.mm-TS-TYPE-OS
127+
```
128+
129+
where:
130+
131+
- `MM` is the PostgreSQL major version (e.g. `16`)
132+
- `mm` is the PostgreSQL minor version (e.g. `10`)
133+
- `TS` is the build timestamp with minute precision (e.g. `202509090953`)
134+
- `TYPE` is image type (e.g. `minimal`)
135+
- `OS` is the underlying distribution (e.g. `trixie`)
136+
137+
For example: `16.10-202509090953-minimal-trixie`.
138+
139+
### Rolling Tags
140+
141+
In addition to fully qualified tags, rolling tags are available in the
142+
following formats:
143+
144+
- `MM.mm-TYPE-OS`: latest image for a given PostgreSQL *minor* version
145+
(`16.10`) of a specific type (`minimal`) on a Debian version (`trixie`).
146+
For example: `16.10-minimal-trixie`.
147+
- `MM-TYPE-OS`: latest image for a given PostgreSQL *major* version (`16`) of
148+
a specific type (`minimal`) on a Debian version (`trixie`).
149+
For example: `16-minimal-trixie`.
150+
151+
### Recommendation
152+
153+
While the most reliable way to reference an image is by its digest, the
154+
`MM.mm-TYPE-OS` tag usually provides a good balance between stability and
155+
convenience for most use cases.
156+
157+
### Deprecated Rolling Tags
158+
159+
For historical reasons, the `system` image also carries two additional rolling
160+
tags:
161+
162+
- `MM.mm`: latest `system` image for a given PostgreSQL *minor* version (e.g.
163+
`16.10`) on Debian `bullseye`.
164+
- `MM`: latest `system` image for a given PostgreSQL *major* version (e.g.
165+
`16`) on Debian `bullseye`.
166+
167+
**IMPORTANT:** These tags are **deprecated** and will be **removed when
168+
`bullseye` images reach end of life**. Please migrate to one of the supported
169+
tag formats that explicitly include both the **image type** and the
170+
**distribution version** (e.g. `16.10-minimal-trixie`).
171+
121172
## Build Attestations
122173

123174
CNPG PostgreSQL Container Images are built with the following attestations to

docker-bake.hcl

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ target "default" {
7070
]
7171
dockerfile = "Dockerfile"
7272
name = "postgresql-${index(split(".",cleanVersion(pgVersion)),0)}-${tgt}-${distroVersion(base)}"
73-
tags = [
73+
tags = concat([
7474
"${fullname}:${index(split(".",cleanVersion(pgVersion)),0)}-${tgt}-${distroVersion(base)}",
7575
"${fullname}:${cleanVersion(pgVersion)}-${tgt}-${distroVersion(base)}",
76-
"${fullname}:${cleanVersion(pgVersion)}-${formatdate("YYYYMMDDhhmm", now)}-${tgt}-${distroVersion(base)}"
77-
]
76+
"${fullname}:${cleanVersion(pgVersion)}-${formatdate("YYYYMMDDhhmm", now)}-${tgt}-${distroVersion(base)}",
77+
], (tgt == "system" && distroVersion(base) == "bullseye") ? getRollingTags("${fullname}", pgVersion) : [])
7878
context = "."
7979
target = "${tgt}"
8080
args = {
@@ -170,3 +170,11 @@ function getPgVersions {
170170
]
171171
)
172172
}
173+
174+
function getRollingTags {
175+
params = [ imageName, pgVersion ]
176+
result = [
177+
format("%s:%s", imageName, pgVersion),
178+
format("%s:%s", imageName, getMajor(pgVersion))
179+
]
180+
}

0 commit comments

Comments
 (0)