Skip to content

Commit ae35214

Browse files
DerRockWolfmnencia
andauthored
feat(docs): add section about bumping Cluster imageName using renovate (#330)
This regex manager example can be used by users of renovate that want to also automate updates of their CNPG clusters. Closes #257 Signed-off-by: RockWolf <git@rockwolf.eu> Signed-off-by: DerRockWolf <50499906+DerRockWolf@users.noreply.github.com> Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com> Co-authored-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
1 parent 76c7482 commit ae35214

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,46 @@ vulnerabilities before they are published or deployed:
261261
For detailed instructions on building PostgreSQL container images, refer to the
262262
[BUILD.md](BUILD.md) file.
263263

264+
## Automated updates with Renovate
265+
266+
[Renovate](https://github.com/renovatebot/renovate) can be used to automatically update various dependencies.
267+
As CloudNativePG's `Cluster` CRDs are not automatically picked up by Renovate, a custom regex manager must be configured.
268+
The example below uses [JSON5](https://json5.org/); save it as `renovate.json5`, or convert keys/comments for use in `renovate.json`:
269+
270+
```json5
271+
{
272+
customManagers: [
273+
{
274+
// CloudNativePG Cluster imageName
275+
customType: 'regex',
276+
managerFilePatterns: [
277+
'/\\.yaml$/',
278+
],
279+
matchStrings: [
280+
'imageName: (?<depName>[^\\s:]+):(?<currentValue>[^\\s@]+)(?:@(?<currentDigest>sha256:[a-f0-9]{64}))?',
281+
],
282+
datasourceTemplate: 'docker',
283+
// matches: 17.6-202509151215-minimal-trixie
284+
versioningTemplate: 'regex:^(?<major>\\d+)\\.(?<minor>\\d+)-(?<patch>\\d+)-(?<compatibility>\\S+)$',
285+
autoReplaceStringTemplate: 'imageName: {{{depName}}}:{{{newValue}}}{{#if newDigest}}@{{{newDigest}}}{{/if}}',
286+
}
287+
],
288+
packageRules: [
289+
{
290+
matchPackageNames: ['ghcr.io/cloudnative-pg/postgresql'],
291+
matchUpdateTypes: ['major'],
292+
dependencyDashboardApproval: true,
293+
}
294+
]
295+
}
296+
```
297+
298+
Renovate will never change the `compatibility` part of the tag (image flavour and Debian base, e.g. `system-bookworm`), so upgrades stay on the same OS and glibc/ICU.
299+
Switching to a different base (e.g. from `bookworm` to `trixie`) is a manual operation because of [PostgreSQL locale-data implications](https://wiki.postgresql.org/wiki/Locale_data_changes).
300+
PostgreSQL major-version updates are routed through the [dependency dashboard](https://docs.renovatebot.com/key-concepts/dashboard/) so they can be planned and applied by a human.
301+
To keep references fully reproducible, you can also enable [`pinDigests`](https://docs.renovatebot.com/configuration-options/#pindigests) scoped to the CloudNativePG image.
302+
If your repository contains other YAML manifests, narrow `managerFilePatterns` to the directory holding your `Cluster` resources, e.g. `'/clusters/.*\\.yaml$/'`.
303+
264304
## License and copyright
265305

266306
This software is available under [Apache License 2.0](LICENSE).

0 commit comments

Comments
 (0)