|
| 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) |
0 commit comments