| 1 |
# Release |
| 2 |
|
| 3 |
The Prometheus Go client library does not follow a strict release schedule. Releases are made based on necessity and the current state of the project. |
| 4 |
|
| 5 |
## Branch Management |
| 6 |
|
| 7 |
We use [Semantic Versioning](https://semver.org/). |
| 8 |
|
| 9 |
- Maintain separate `release-<major>.<minor>` branches |
| 10 |
- Branch protection enabled automatically for `release-*` branches |
| 11 |
- Bug fixes go to the latest release branch, then merge to main |
| 12 |
- Features and changes go to main branch |
| 13 |
- Non-latest minor release branches are maintained (e.g. bug and security fixes) on the best-effort basis |
| 14 |
|
| 15 |
## Pre-Release Preparations |
| 16 |
|
| 17 |
1. Review main branch state: |
| 18 |
- Expedite critical bug fixes |
| 19 |
- Don't rush on risky changes, consider them for the next release if not ready |
| 20 |
- Update dependencies via Dependabot PRs or manually if needed |
| 21 |
- Check for security alerts |
| 22 |
|
| 23 |
## Cutting a Minor Release |
| 24 |
|
| 25 |
1. Create release branch: |
| 26 |
|
| 27 |
```bash |
| 28 |
git checkout -b release-<major>.<minor> main |
| 29 |
git push origin release-<major>.<minor> |
| 30 |
``` |
| 31 |
|
| 32 |
2. Create a new branch on top of `release-<major>.<minor>`: |
| 33 |
|
| 34 |
```bash |
| 35 |
git checkout -b <yourname>/cut-<major>.<minor>.0 release-<major>.<minor> |
| 36 |
``` |
| 37 |
|
| 38 |
3. Update version and documentation: |
| 39 |
- Update `VERSION` file |
| 40 |
- Update `CHANGELOG.md` (user-impacting changes) |
| 41 |
- Each release documents the minimum required Go version |
| 42 |
- Order: [SECURITY], [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX] |
| 43 |
- For RCs, append `-rc.0` |
| 44 |
|
| 45 |
4. Create PR and get review |
| 46 |
|
| 47 |
5. After merge, create tags: |
| 48 |
|
| 49 |
```bash |
| 50 |
tag="v$(< VERSION)" |
| 51 |
git tag -s "${tag}" -m "${tag}" |
| 52 |
git push origin "${tag}" |
| 53 |
``` |
| 54 |
|
| 55 |
6. Create a draft release. |
| 56 |
- Copy Changelog section. |
| 57 |
- You can also generate automatic changelog and put the `What's changed` section under `<summary>` HTML tag. This will render all contributors nicely as in the [example](https://github.com/prometheus/client_golang/releases/tag/v1.21.0-rc.0) release. |
| 58 |
|
| 59 |
7a. For Release Candidates: |
| 60 |
- Release RC GitHub release with "pre-release" box checked |
| 61 |
- Click "Publish release"! |
| 62 |
- Create PR against [prometheus/prometheus](https://github.com/prometheus/prometheus) using RC version (e.g. https://github.com/prometheus/prometheus/pull/15851) |
| 63 |
- Create PR against [kubernetes/kubernetes](https://github.com/kubernetes/kubernetes) using RC version (e.g. https://github.com/kubernetes/kubernetes/pull/129752) |
| 64 |
- Kubernetes uses scripts to update deps e.g.: |
| 65 |
|
| 66 |
```bash |
| 67 |
./hack/pin-dependency.sh github.com/prometheus/client_golang v1.21.0-rc.0 |
| 68 |
./hack/update-vendor.sh |
| 69 |
# If indirect dependencies changed, following check will fail on the CI: |
| 70 |
./hack/verify-vendor.sh |
| 71 |
# You will need to modify hack/unwanted-dependencies.json manually as the check suggests. |
| 72 |
``` |
| 73 |
|
| 74 |
- Make sure the CI is green for the PRs |
| 75 |
- Allow 1-2 days for downstream testing |
| 76 |
- Fix any issues found before final release |
| 77 |
- Use `-rc.1`, `-rc.2` etc. for additional fixes |
| 78 |
|
| 79 |
7b. For Final Release: |
| 80 |
- Release GitHub release with "latest" box checked (default). |
| 81 |
- Click "Publish release"! |
| 82 |
|
| 83 |
8. Announce release: |
| 84 |
- <[email protected]> |
| 85 |
- Slack |
| 86 |
- x.com/BlueSky |
| 87 |
|
| 88 |
9. Merge release branch to main: |
| 89 |
|
| 90 |
```bash |
| 91 |
git checkout main |
| 92 |
git merge --no-ff release-<major>.<minor> |
| 93 |
``` |
| 94 |
|
| 95 |
## Cutting a Patch Release |
| 96 |
|
| 97 |
1. Create branch from release branch: |
| 98 |
|
| 99 |
```bash |
| 100 |
git checkout -b <yourname>/cut-<major>.<minor>.<patch> release-<major>.<minor> |
| 101 |
``` |
| 102 |
|
| 103 |
2. Apply fixes: |
| 104 |
- Commit the required fixes; avoid refactoring or otherwise risky changes (preferred) |
| 105 |
- Cherry-pick from main if fix was already merged there: `git cherry-pick <commit>` |
| 106 |
|
| 107 |
3. Follow steps 3-9 from minor release process |
| 108 |
|
| 109 |
## Handling Merge Conflicts |
| 110 |
|
| 111 |
If conflicts occur merging to main: |
| 112 |
|
| 113 |
1. Create branch: `<yourname>/resolve-conflicts` |
| 114 |
2. Fix conflicts there |
| 115 |
3. PR into main |
| 116 |
4. Leave release branch unchanged |
| 117 |
|
| 118 |
## Note on Versioning |
| 119 |
|
| 120 |
## Compatibility Guarantees |
| 121 |
|
| 122 |
### Supported Go Versions |
| 123 |
|
| 124 |
- Support provided only for the two most recent major Go releases |
| 125 |
- While the library may work with older Go versions, support and fixes are best-effort for those. |
| 126 |
- Each release documents the minimum required Go version |
| 127 |
|
| 128 |
### API Stability |
| 129 |
|
| 130 |
The Prometheus Go client library aims to maintain backward compatibility within minor versions, similar to [Go 1 compatibility promises](https://golang.org/doc/go1compat): |
| 131 |
|
| 132 |
|
| 133 |
## Minor Version Changes |
| 134 |
- API signatures are `stable` within a **minor** version |
| 135 |
- No breaking changes are introduced |
| 136 |
- Methods may be added, but not removed |
| 137 |
- Arguments may NOT be removed or added (unless varargs) |
| 138 |
- Return types may NOT be changed |
| 139 |
- Types may be modified or relocated |
| 140 |
- Default behaviors might be altered (unfortunately, this has happened in the past) |
| 141 |
|
| 142 |
## Major Version Changes |
| 143 |
- API signatures may change between **major** versions |
| 144 |
- Types may be modified or relocated |
| 145 |
- Default behaviors might be altered |
| 146 |
- Feature removal/deprecation can occur with minor version bump |
| 147 |
|
| 148 |
### Compatibility Testing |
| 149 |
|
| 150 |
Before each release: |
| 151 |
|
| 152 |
1. **Internal Testing**: |
| 153 |
- Full test suite must pass |
| 154 |
- Integration tests with latest Prometheus server |
| 155 |
- (optional) Benchmark comparisons with previous version |
| 156 |
> There is no facility for running benchmarks in CI, so this is best-effort. |
| 157 |
|
| 158 |
2. **External Validation**: |
| 159 |
|
| 160 |
Test against bigger users, especially looking for broken tests or builds. This will give us awareness of a potential accidental breaking changes, or if there were intentional ones, the potential damage radius of them. |
| 161 |
|
| 162 |
- Testing with [prometheus/prometheus](https://github.com/prometheus/prometheus) `main` branch |
| 163 |
- Testing with [kubernetes/kubernetes](https://github.com/kubernetes/kubernetes) `main` branch |
| 164 |
- Breaking changes must be documented in CHANGELOG.md |
| 165 |
|
| 166 |
### Version Policy |
| 167 |
|
| 168 |
- Bug fixes increment patch version (e.g., v0.9.1) |
| 169 |
- New features increment minor version (e.g., v0.10.0) |
| 170 |
- Breaking changes increment minor version with clear documentation |
| 171 |
|
| 172 |
### Deprecation Policy |
| 173 |
|
| 174 |
1. Features may be deprecated in any minor release |
| 175 |
2. Deprecated features: |
| 176 |
- Will be documented in CHANGELOG.md |
| 177 |
- Will emit warnings when used (when possible) |
| 178 |
|