Skip to content

Commit 461000f

Browse files
authored
adds renovate config for automatic bumps and switches to ghcr (#198)
* adds renovate config for automatic bumps and switches to ghcr Signed-off-by: ChrisJBurns <29541485+ChrisJBurns@users.noreply.github.com> * bumps chart to 5.1.0 Signed-off-by: ChrisJBurns <29541485+ChrisJBurns@users.noreply.github.com> --------- Signed-off-by: ChrisJBurns <29541485+ChrisJBurns@users.noreply.github.com>
1 parent ebfc81f commit 461000f

5 files changed

Lines changed: 154 additions & 10 deletions

File tree

charts/pact-broker/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
name: pact-broker
33
description: The Pact Broker is an application for sharing for Pact contracts and verification results.
44
type: application
5-
version: 5.0.0
5+
version: 5.1.0
66
appVersion: 2.112.0
77
dependencies:
88
- name: common

charts/pact-broker/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# pact-broker
22

3-
![Version: 5.0.0](https://img.shields.io/badge/Version-5.0.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.112.0](https://img.shields.io/badge/AppVersion-2.112.0-informational?style=flat-square)
3+
![Version: 5.1.0](https://img.shields.io/badge/Version-5.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.112.0](https://img.shields.io/badge/AppVersion-2.112.0-informational?style=flat-square)
44

55
The Pact Broker is an application for sharing for Pact contracts and verification results.
66

@@ -122,7 +122,7 @@ helm upgrade -i <release_name> oci://ghcr.io/pact-foundation/pact-broker-chart/p
122122
| broker.containerSecurityContext.runAsNonRoot | Set Pact Broker container's Security Context runAsNonRoot | bool | `true` |
123123
| broker.containerSecurityContext.runAsUser | Set Pact Broker container's Security Context runAsUser | int | `1001` |
124124
| broker.extraContainers | Additional containers to add to the Pact Broker pods | list | `[]` |
125-
| broker.image | Pact Broker image url | string | `"docker.io/pactfoundation/pact-broker:2.124.0-pactbroker2.112.0"` |
125+
| broker.image | Pact Broker image url | string | `"ghcr.io/pact-foundation/pact-broker:2.124.0-pactbroker2.112.0"` |
126126
| broker.imagePullPolicy | Specify a imagePullPolicy Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent' more info [here](https://kubernetes.io/docs/user-guide/images/#pre-pulling-images) | string | `"IfNotPresent"` |
127127
| broker.imagePullSecrets | Array of imagePullSecrets to allow pulling the Pact Broker image from private registries. PS: Secret's must exist in the namespace to which you deploy the Pact Broker. more info [here](https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/) Example: pullSecrets: - mySecretName | list | `[]` |
128128
| broker.labels | Additional labels that can be added to the Broker deployment | object | `{}` |

charts/pact-broker/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
broker:
33

44
# -- Pact Broker image url
5-
image: docker.io/pactfoundation/pact-broker:2.124.0-pactbroker2.112.0
5+
image: ghcr.io/pact-foundation/pact-broker:2.124.0-pactbroker2.112.0
66

77
# -- Specify a imagePullPolicy
88
# Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'

docs/RENOVATE_VERSIONING.md

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
# Renovate Configuration for Pact Broker Double Versioning
2+
3+
## The Challenge: Compound Version Numbers
4+
5+
The Pact Broker Docker images use a compound versioning scheme that includes two separate version numbers:
6+
7+
```
8+
2.124.0-pactbroker2.112.0
9+
│ │ │
10+
│ │ └── Pact Broker Ruby Gem version
11+
│ └──────────────── Hyphen separator with "pactbroker" prefix
12+
└──────────────────────── Docker image version
13+
```
14+
15+
### Version Progression Example
16+
17+
Here's how the versions have progressed:
18+
- `2.120.0-pactbroker2.110.0`
19+
- `2.124.0-pactbroker2.112.0` (current)
20+
- `2.125.0-pactbroker2.113.0` (both parts updated)
21+
- `2.126.0-pactbroker2.113.0` (only Docker version updated)
22+
- `2.127.0-pactbroker2.113.2` (gem patch version update)
23+
- `2.128.0-pactbroker2.114.0` (both parts updated)
24+
- `2.133.0-pactbroker2.116.0` (latest)
25+
26+
## The Problem
27+
28+
Standard semantic versioning (semver) doesn't handle this dual-version format well because:
29+
1. The version contains two independent version numbers
30+
2. Either part can be updated independently
31+
3. Version comparison needs to consider both parts hierarchically
32+
33+
## The Solution: Loose Versioning
34+
35+
We've configured Renovate to use **"loose" versioning** instead of strict regex versioning. This approach:
36+
37+
1. **More Flexible Parsing**: Loose versioning can handle non-standard version formats
38+
2. **Natural Ordering**: It understands that `2.125.0-pactbroker2.113.0` > `2.124.0-pactbroker2.112.0`
39+
3. **Handles Both Components**: Properly compares the full version string
40+
41+
### Configuration
42+
43+
```json
44+
{
45+
"packageRules": [
46+
{
47+
"description": "Configure versioning for Pact Broker Docker image",
48+
"matchPackageNames": [
49+
"ghcr.io/pact-foundation/pact-broker"
50+
],
51+
"matchDatasources": ["docker"],
52+
"versioning": "loose" // ← Key change: using "loose" instead of regex
53+
}
54+
],
55+
"customManagers": [
56+
{
57+
"customType": "regex",
58+
"matchStrings": [
59+
"image: ghcr\\.io/pact-foundation/pact-broker:(?<currentValue>[0-9]+\\.[0-9]+\\.[0-9]+-pactbroker[0-9]+\\.[0-9]+\\.[0-9]+)"
60+
],
61+
"versioningTemplate": "loose" // ← Also using "loose" here
62+
}
63+
]
64+
}
65+
```
66+
67+
## How Loose Versioning Works
68+
69+
Loose versioning:
70+
1. Splits the version string into comparable segments
71+
2. Compares numeric parts numerically
72+
3. Compares string parts alphabetically
73+
4. Handles pre-release identifiers correctly
74+
75+
For `2.124.0-pactbroker2.112.0` vs `2.125.0-pactbroker2.113.0`:
76+
1. First compares `2.124.0` vs `2.125.0` → 2.125.0 is newer
77+
2. If equal, would then compare the suffix parts
78+
79+
## Testing the Configuration
80+
81+
### Local Testing (Limited)
82+
```bash
83+
# Run renovate locally (won't fetch remote versions)
84+
renovate --platform=local
85+
86+
# With debug output
87+
LOG_LEVEL=debug renovate --platform=local
88+
```
89+
90+
### Full Testing (Requires GitHub Token)
91+
```bash
92+
# Set your GitHub token
93+
export GITHUB_TOKEN=your_github_token_here
94+
95+
# Run against the repository
96+
renovate --platform=github --repository=your-org/pact-broker-chart
97+
```
98+
99+
## Expected Behavior
100+
101+
With this configuration, Renovate should:
102+
1. ✅ Detect the current version: `2.124.0-pactbroker2.112.0`
103+
2. ✅ Fetch available versions from GitHub Container Registry
104+
3. ✅ Recognize `2.133.0-pactbroker2.116.0` as newer
105+
4. ✅ Create a PR to update the image version
106+
107+
## Alternative Approaches (If Loose Versioning Fails)
108+
109+
### Option 1: Custom Regex with Explicit Version Parts
110+
```json
111+
{
112+
"versioning": "regex:^(?<major>\\d+)\\.(?<minor>\\d+)\\.(?<patch>\\d+)-pactbroker(?<compatibility>\\d+\\.\\d+\\.\\d+)$",
113+
"extractVersion": "^(?<version>\\d+\\.\\d+\\.\\d+-pactbroker\\d+\\.\\d+\\.\\d+)$"
114+
}
115+
```
116+
117+
### Option 2: Docker Versioning
118+
```json
119+
{
120+
"versioning": "docker"
121+
}
122+
```
123+
Docker versioning understands tags with hyphens and might handle this format.
124+
125+
### Option 3: Treat Entire String as Version
126+
```json
127+
{
128+
"versioning": "regex:^(?<version>.+)$"
129+
}
130+
```
131+
This treats the entire string as an opaque version for string comparison.
132+
133+
## Monitoring Updates
134+
135+
To verify Renovate is working:
136+
1. Check the Renovate dashboard/logs after deployment
137+
2. Look for created PRs with title like "Update ghcr.io/pact-foundation/pact-broker"
138+
3. Verify the PR updates both version components correctly
139+
140+
## References
141+
142+
- [Renovate Versioning Schemes](https://docs.renovatebot.com/modules/versioning/)
143+
- [Loose Versioning Documentation](https://docs.renovatebot.com/modules/versioning/#loose)
144+
- [Pact Broker Releases](https://github.com/pact-foundation/pact-broker-docker/releases)

renovate.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,27 @@
77
{
88
"description": "Configure versioning for Pact Broker Docker image",
99
"matchPackageNames": [
10-
"pactfoundation/pact-broker"
10+
"ghcr.io/pact-foundation/pact-broker"
1111
],
1212
"matchDatasources": [
1313
"docker"
1414
],
15-
"versioning": "regex:^(?<major>\\d+)\\.(?<minor>\\d+)\\.(?<patch>\\d+)(-pactbroker(?<compatibility>.*))?$"
15+
"versioning": "loose"
1616
}
1717
],
1818
"customManagers": [
1919
{
2020
"customType": "regex",
2121
"description": "Update Pact Broker Docker image version in Helm values",
2222
"managerFilePatterns": [
23-
"/^charts/pact-broker/values\\.yaml$/"
23+
"charts/pact-broker/values\\.yaml"
2424
],
2525
"matchStrings": [
26-
"repository: pactfoundation/pact-broker[\\s\\S]*?tag: (?<currentValue>[0-9]+\\.[0-9]+\\.[0-9]+-pactbroker[0-9]+\\.[0-9]+\\.[0-9]+)"
26+
"image: ghcr\\.io/pact-foundation/pact-broker:(?<currentValue>[0-9]+\\.[0-9]+\\.[0-9]+-pactbroker[0-9]+\\.[0-9]+\\.[0-9]+)"
2727
],
2828
"datasourceTemplate": "docker",
29-
"packageNameTemplate": "pactfoundation/pact-broker",
30-
"versioningTemplate": "regex:^(?<major>\\d+)\\.(?<minor>\\d+)\\.(?<patch>\\d+)(-pactbroker(?<compatibility>.*))?$"
29+
"packageNameTemplate": "ghcr.io/pact-foundation/pact-broker",
30+
"versioningTemplate": "loose"
3131
}
3232
]
3333
}

0 commit comments

Comments
 (0)