Skip to content

Commit 9f43217

Browse files
joestringeraanm
authored andcommitted
checklist: Add golden tests for substitutions
This test evaluates that the version substitutions in the release templates will work correctly. The downside is that any change to templates will require modifying both the template and the golden file. The good thing is that this can help to detect problems where we write the template in a way that doesn't properly apply the version string substitutions that the tool is intended to apply. Use 'make generate-golden' to regenerate the golden test content from the templates. Signed-off-by: Joe Stringer <[email protected]>
1 parent 7ae86cb commit 9f43217

10 files changed

+649
-0
lines changed

Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,16 @@ all: tests release
99
docker-image:
1010
docker build $(DOCKER_BUILD_FLAGS) -t cilium/release-tool:${IMAGE_TAG} .
1111

12+
.PHONY: generate-golden
13+
generate-golden:
14+
$(MAKE) $(patsubst %.input,%.golden,$(shell find ./testdata/checklist/ -name "*.input"))
15+
16+
%.golden: %.input
17+
$(GO) run ./cmd/ checklist open --dry-run \
18+
--target-version "v1.10.0-pre.0" \
19+
--template $< \
20+
> $@ \
21+
1222
.PHONY: tests
1323
tests:
1424
$(GO) test -mod=vendor ./...

cmd/checklist/template_test.go

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
package checklist
55

66
import (
7+
"os"
8+
"path/filepath"
79
"testing"
810

911
"github.com/stretchr/testify/assert"
@@ -71,3 +73,34 @@ func Test_assembleVersionSubstitutions(t *testing.T) {
7173
assert.Equal(t, sub, tt.want, tt.name+" generated unexpected substitutions")
7274
}
7375
}
76+
77+
func Test_prepareChecklist(t *testing.T) {
78+
cfg := ChecklistConfig{
79+
TargetVer: "v1.10.0-pre.0",
80+
}
81+
testdataPath := filepath.Join("..", "..", "testdata", "checklist")
82+
83+
paths, err := filepath.Glob(filepath.Join(testdataPath, "*.input"))
84+
if err != nil {
85+
t.Fatal(err)
86+
}
87+
88+
for _, path := range paths {
89+
_, filename := filepath.Split(path)
90+
testname := filename[:len(filename)-len(filepath.Ext(path))]
91+
92+
t.Run(testname, func(t *testing.T) {
93+
source, err := os.ReadFile(path)
94+
assert.Nil(t, err, "failed to read input template: ", err)
95+
96+
output, err := prepareChecklist(source, cfg)
97+
assert.Nil(t, err, "failed to render checklist: ", err)
98+
99+
golden := filepath.Join(testdataPath, testname+".golden")
100+
want, err := os.ReadFile(golden)
101+
assert.Nil(t, err, "error reading golden output: ", err)
102+
103+
assert.Equal(t, output, string(want), "template processing did not match golden output. Check for bugs or run 'make generate-golden' to update the golden tests.")
104+
})
105+
}
106+
}
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
---
2+
name: Release a new minor version of Cilium from a stable branch
3+
about: Create a checklist for an upcoming release
4+
title: 'v1.10.0 release'
5+
labels: kind/release
6+
assignees: ''
7+
8+
---
9+
10+
## Setup preparation
11+
12+
- [ ] Depending on your OS, make sure Docker is running
13+
- [ ] Export a [`GITHUB_TOKEN`](https://github.com/settings/tokens/new?description=Cilium%20Release%20Script&scopes=write:org,public_repo) that has access to the repository
14+
- [ ] Make sure a setup (GPG, SSH, S/MIME) is in place for [signing tags] with Git
15+
- [ ] Make sure the `GOPATH` environment variable is set and pointing to the relevant path
16+
- [ ] Make sure the [Cilium helm charts][Cilium charts] and [release][Cilium release-notes tool] repositories are installed locally:
17+
- [ ] Run `git clone https://github.com/cilium/charts.git "$GOPATH/src/github.com/cilium/charts"`
18+
- [ ] Run `git clone https://github.com/cilium/release.git "$GOPATH/src/github.com/cilium/release"`
19+
- [ ] If you already have the repo checked out, make sure the `release` binary is up to date:
20+
21+
git checkout master && git pull && make
22+
23+
## Pre-release
24+
25+
- [ ] Announce in Cilium slack channel #launchpad: `Starting v1.10.0 release process :ship:`
26+
- [ ] Create a thread for that message and ping current top-hat to not merge any
27+
PRs until the release process is complete.
28+
- [ ] Change directory to the local copy of Cilium repository.
29+
- [ ] Check that there are no [release blockers] for the targeted release version
30+
- [ ] Ensure that outstanding [backport PRs] are merged
31+
- [ ] Check with @cilium/security team if there are any security fixes to include
32+
in the release.
33+
- [ ] Execute `release --current-version 1.10.0 --next-dev-version 1.10.1` to
34+
automatically move any unresolved issues/PRs from old release project
35+
into the new project. The `release` binary is located in the
36+
[current repository][Cilium release-notes tool].
37+
- [ ] Push a PR including the changes necessary for the new release:
38+
- [ ] Pull latest changes from the branch being released
39+
- [ ] The next step will generate a `CHANGELOG.md` that will not be correct.
40+
That is expected, and it is fixed with a follow-up step. Don't worry.
41+
- [ ] Run `../release/internal/start-release.sh 1.10.0 <GH-PROJECT> 1.9`
42+
Note that this script produces some files at the root of the Cilium
43+
repository, and that these files are required at a later step for
44+
tagging the release.
45+
- [ ] `rm CHANGELOG.md`
46+
- [ ] Regenerate the log since the previous release with `prep-changelog.sh <last-patch-release> v1.10.0`
47+
- [ ] Check and edit the `CHANGELOG.md` to ensure all PRs have proper release notes
48+
- [ ] Edit the `v1.10.0-changes.txt` files locally to replace the text with "See CHANGELOG.md for more details"
49+
- [ ] Add the 'stable' tag as part of the GitHub workflow and remove the
50+
'stable' tag from the last stable branch.
51+
- [ ] Commit all changes with title `Prepare for release v1.10.0`
52+
- [ ] Submit PR (`../release/internal/submit-release.sh`)
53+
- [ ] Submit a PR that removes the 'stable' tag from the last stable branch.
54+
- [ ] Merge PR
55+
- [ ] Create and push *both* tags to GitHub (`v1.10.0`, `1.10.0`)
56+
- [ ] Pull latest branch locally and run `../release/internal/tag-release.sh`.
57+
- [ ] Ask a maintainer to approve the build in the following link (keep the URL
58+
of the GitHub run to be used later):
59+
[Cilium Image Release builds](https://github.com/cilium/cilium/actions?query=workflow:%22Image+Release+Build%22)
60+
- [ ] Check if all docker images are available before announcing the release:
61+
`make -C install/kubernetes/ check-docker-images`
62+
- [ ] Get the image digests from the build process and make a commit and PR with
63+
these digests.
64+
- [ ] Run `../release/internal/post-release.sh URL` to fetch the image
65+
digests and submit a PR to update these, use the `URL` of the GitHub
66+
run here
67+
- [ ] Get someone to review the PR. Do not trigger the full CI suite, but
68+
wait for the automatic checks to complete. Merge the PR.
69+
- [ ] Update helm charts
70+
- [ ] Create helm charts artifacts in [Cilium charts] repository using
71+
[cilium helm release tool] for the `v1.10.0` release.
72+
- [ ] Check the output of the [chart workflow] and see if the test was
73+
successful.
74+
- [ ] Check [read the docs] configuration:
75+
- [ ] Set the [default version] and mark the EOL version as active, and
76+
hidden and configure the new minor version as active and **not**
77+
hidden in [active versions].
78+
- [ ] Update algolia configuration search in [docsearch-scraper-webhook].
79+
- [ ] Check draft release from [releases] page
80+
- [ ] Update the text at the top with 2-3 highlights of the release
81+
- [ ] Publish the release
82+
- [ ] Announce the release in #general on Slack (Use [@]channel for v1.10.0)
83+
- [ ] Update Grafana dashboards
84+
85+
## Post-release
86+
87+
- [ ] Update the upgrade guide and [roadmap](https://github.com/cilium/cilium/blob/main/Documentation/community/roadmap.rst) for any features that changed status.
88+
- [ ] For new minor version update [security policy]
89+
- [ ] Prepare post-release changes to main branch using `../release/internal/bump-readme.sh`
90+
- [ ] Make sure to update the `.github/maintainers-little-helper.yaml` so that
91+
upcoming PRs are tracked correctly for the next release.
92+
- [ ] Bump the main testsuite to upgrade from v1.10 branch to main
93+
- [ ] `echo 1.10.0 > stable.txt`.
94+
- [ ] `echo '{"results":[{"slug":"v1.10"}]}' > Documentation/_static/stable-version.json`.
95+
- [ ] Commit / amend the commit to add all of the changes above and push the PR.
96+
- [ ] Merge the post-release PR.
97+
- [ ] Notify #development on Slack that deprecated features may now be removed.
98+
- [ ] This is the list of links for known external installers that depend on
99+
the release process. Ideally, work toward updating external tools and
100+
guides to point to the new Cilium version. If you find where to submit
101+
the update, please add the relevant links to this template.
102+
- [kops]
103+
- [kubespray]
104+
- [network policy]
105+
- [cluster administration networking]
106+
- [cluster administration addons]
107+
108+
109+
[signing tags]: https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-tags
110+
[release blockers]: https://github.com/cilium/cilium/labels/release-blocker%2F1.10
111+
[backport PRs]: https://github.com/cilium/cilium/pulls?q=is%3Aopen+is%3Apr+label%3Abackport%2F1.10
112+
[Cilium release-notes tool]: https://github.com/cilium/release
113+
[Cilium charts]: https://github.com/cilium/charts
114+
[releases]: https://github.com/cilium/cilium/releases
115+
[kops]: https://github.com/kubernetes/kops/
116+
[kubespray]: https://github.com/kubernetes-sigs/kubespray/
117+
[cilium helm release tool]: https://github.com/cilium/charts/blob/master/RELEASE.md
118+
[cilium-runtime images]: https://quay.io/repository/cilium/cilium-runtime
119+
[read the docs]: https://readthedocs.org/projects/cilium/
120+
[active versions]: https://readthedocs.org/projects/cilium/versions/
121+
[default version]: https://readthedocs.org/dashboard/cilium/advanced/
122+
[docsearch-scraper-webhook]: https://github.com/cilium/docsearch-scraper-webhook
123+
[security policy]: https://github.com/cilium/cilium/security/policy
124+
[network policy]: https://kubernetes.io/docs/tasks/administer-cluster/network-policy-provider/cilium-network-policy/
125+
[cluster administration networking]: https://kubernetes.io/docs/concepts/cluster-administration/networking/
126+
[cluster administration addons]: https://kubernetes.io/docs/concepts/cluster-administration/addons/
127+
[chart workflow]: https://github.com/cilium/charts/actions/workflows/validate-cilium-chart.yaml
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../.github/ISSUE_TEMPLATE/release_template_minor.md
Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
---
2+
name: NEW Release a new patch version of Cilium from a stable branch
3+
about: Create a checklist for an upcoming release
4+
title: 'v1.10.0 release'
5+
labels: kind/release
6+
assignees: ''
7+
8+
---
9+
10+
## Setup preparation
11+
12+
- [ ] Depending on your OS, make sure Docker is running
13+
- [ ] Export a [`GITHUB_TOKEN`](https://github.com/settings/tokens/new?description=Cilium%20Release%20Script&scopes=write:org,public_repo,project) that has access to the repository. Only classic tokens are
14+
[supported at the moment][GitHub PAT tracker], the needed scopes are `write:org`, `public_repo` and `project`.
15+
- [ ] Make sure a setup (GPG, SSH, S/MIME) is in place for [signing tags]
16+
with Git and install [gh](https://cli.github.com).
17+
- [ ] Make sure the [Cilium helm charts][Cilium charts] and [release][Cilium release-notes tool] repositories are installed locally:
18+
- [ ] Run `git clone https://github.com/cilium/charts.git "$GOPATH/src/github.com/cilium/charts"`
19+
- [ ] Run `git clone https://github.com/cilium/release.git "$GOPATH/src/github.com/cilium/release"`
20+
- [ ] If you already have the repo checked out, make sure the `release` binary is up to date:
21+
22+
git checkout main && git pull && make
23+
- [ ] Read the documentation of `release start --help` tool to understand what
24+
each automated step does.
25+
26+
## Pre-check (run ~1 week before release date)
27+
28+
- [ ] When you create a GitHub issue using this issue template, GitHub Slack app posts a
29+
message in #launchpad Slack channel. Create a thread for that message and ping the
30+
current backporter to merge the outstanding [backport PRs] and stop merging any new
31+
backport PRs until the GitHub issue is closed (to avoid generating incomplete
32+
release notes).
33+
- [ ] Run `./release start --steps 1-pre-check --target-version v1.10.0`
34+
- [ ] Check that there are no [release blockers] for the targeted release
35+
version.
36+
- [ ] Ensure that outstanding [backport PRs] are merged (these may be
37+
skipped on case by case basis in coordination with the backporter).
38+
- [ ] Check with @cilium/security team in case there are any CVEs found in the
39+
docker image.
40+
- [ ] Check with @cilium/security team if there are any security fixes to
41+
include in the release.
42+
43+
## Preparation PR (run ~1 day before release date. It can be re-run multiple times.)
44+
45+
- [ ] Go to [release workflow] and Run the workflow from "Branch: main", for
46+
step "2-prepare-release" and version for v1.10.0
47+
- [ ] Check if the workflow was successful and check the PR opened by the
48+
Release bot.
49+
- [ ] Merge PR
50+
51+
## Tagging
52+
53+
- [ ] Ask a maintainer if there are any known issues that should hold up the release
54+
- [ ] FYI, do not wait too much time between a tag is created and the helm charts are published.
55+
Once the tags are published the documentation will be pointing to them. Until we release
56+
the helm chart, users will face issues while trying out our documentation.
57+
- [ ] Run `./release start --steps 3-tag --target-version v1.10.0`
58+
- [ ] Ask a maintainer to approve the build in the following link (keep the URL
59+
of the GitHub run to be used later):
60+
[Cilium Image Release builds](https://github.com/cilium/cilium/actions?query=workflow:%22Image+Release+Build%22)
61+
62+
## Post Tagging (run after docker images are published)
63+
64+
- [ ] Go to [release workflow] and Run the workflow from "Branch: main", for
65+
step "4-post-release" and version for v1.10.0
66+
- [ ] Check if the workflow was successful and check the PR opened by the
67+
Release bot.
68+
- [ ] Merge PR
69+
- [ ] This step opened a [GitHub project](https://github.com/orgs/cilium/projects?query=is%3Aopen++v+)
70+
to track the PRs in the release. Close the corresponding project.
71+
72+
## Publish helm (run after docker images are published)
73+
74+
- [ ] Update helm charts `./release start --steps 5-publish-helm --target-version v1.10.0`
75+
- [ ] Open [Charts Workflow] and check if the workflow run is successful.
76+
77+
## Publish docs (only for pre/rc releases)
78+
79+
- [ ] Check [read the docs] configuration:
80+
- [ ] Set a new build as active and hidden in [active versions].
81+
- [ ] Deactivate previous RCs.
82+
- [ ] Update algolia configuration search in [docsearch-scraper-webhook].
83+
- Update the versions in `docsearch.config.json`, commit them and push a
84+
trigger the workflow [here](https://github.com/cilium/docsearch-scraper-webhook/actions/workflows/update-algolia-index.yaml)
85+
86+
## Post-release
87+
88+
- [ ] Check draft release from [releases] page
89+
- [ ] Update the text at the top with 2-3 highlights of the release
90+
- [ ] Check with @cilium/security if the release addresses any open security
91+
advisory. If it does, include the list of security advisories at the
92+
top of the release notes.
93+
- [ ] Check whether the new release should be set as the _latest_ release
94+
(via the checkbox at the bottom of the page). It should be the new
95+
_latest_ if the version number is strictly superior to the current
96+
_latest_ release displayed on GitHub (e.g. 1.11.13 does not become the
97+
new latest release over 1.12.5, but version 1.12.6 will).
98+
- [ ] Publish the release
99+
- [ ] Announce the release in #general on Slack (do not use [@]channel).
100+
See below for templates.
101+
- [ ] Prepare post-release changes to main branch using `../release/internal/bump-readme.sh`.
102+
103+
---
104+
105+
## Slack example text templates
106+
107+
### Patch releases
108+
109+
```
110+
:confetti_ball: :cilium-radiant: Release Announcement :cilium-radiant::confetti_ball:
111+
112+
Cilium v1.10.0, vA.B.C, and vD.E.F have been released. Thanks all for your contributions! Please see the release notes below for details :cilium-gopher:
113+
114+
v1.10.0: https://github.com/cilium/cilium/releases/tag/v1.10.0
115+
vA.B.C: https://github.com/cilium/cilium/releases/tag/vA.B.C
116+
vD.E.F: https://github.com/cilium/cilium/releases/tag/vD.E.F
117+
```
118+
119+
### First pre-release
120+
121+
```
122+
:cilium-new: *Cilium v1.10.0-pre.0 has been released:*
123+
https://github.com/cilium/cilium/releases/tag/v1.10.0-pre.0
124+
125+
This is the first monthly snapshot for the v1.10 development cycle. There are [v1.10.0-pre.0 OSS docs](https://docs.cilium.io/en/v1.10.0-pre.0) available if you want to pull this version & try it out.
126+
```
127+
128+
### Subsequent pre-/rc- releases
129+
130+
```
131+
*Announcement* :tada: :tada:
132+
133+
:cilium-new: *Cilium v1.10.0-pre.0 has been released:*
134+
https://github.com/cilium/cilium/releases/tag/v1.10.0-pre.0
135+
136+
Thank you for the testing and contributing to the previous pre-releases. There are [v1.10.0-pre.0 OSS docs](https://docs.cilium.io/en/v1.10.0-pre.0) available if you want to pull this version & try it out.
137+
```
138+
139+
[release workflow]: https://github.com/cilium/cilium/actions/workflows/release.yaml
140+
[GitHub PAT tracker]: https://github.com/orgs/community/discussions/36441
141+
[signing tags]: https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-tags
142+
[release blockers]: https://github.com/cilium/cilium/labels/release-blocker%2F1.10
143+
[backport PRs]: https://github.com/cilium/cilium/pulls?q=is%3Aopen+is%3Apr+draft%3Afalse+label%3Abackport%2F1.10
144+
[Cilium release-notes tool]: https://github.com/cilium/release
145+
[Cilium charts]: https://github.com/cilium/charts
146+
[Charts Workflow]: https://github.com/cilium/charts/actions/workflows/validate-cilium-chart.yaml
147+
[releases]: https://github.com/cilium/cilium/releases
148+
[cilium helm release tool]: https://github.com/cilium/charts/blob/master/RELEASE.md
149+
[cilium-runtime images]: https://quay.io/repository/cilium/cilium-runtime
150+
[chart workflow]: https://github.com/cilium/charts/actions/workflows/validate-cilium-chart.yaml
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../.github/ISSUE_TEMPLATE/release_template_patch.md

0 commit comments

Comments
 (0)