Skip to content

Commit 0645c50

Browse files
authored
feat: add cockpit to release process (#133)
* feat: add cockpit * fix: set the Antora version for the cockpit docs * refactor(release): reuse operator functions for cockpit Replace the cockpit-specific copies of check/update/tag functions with the operator versions, extract a merge_repo helper in merge-release-candidate.sh, make messages repo-neutral and fix the cockpit README bullet. * fix: pr feedback * refactor: make it refer to a repo * refactor(release): use jaq for the cockpit JSON files * refactor(release): pass versions to yq via strenv
1 parent c2bdb0c commit 0645c50

11 files changed

Lines changed: 258 additions & 103 deletions

‎release/EXAMPLE_PROCESS.md‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ It is a good idea to do a dry-run check locally, and then delete the local state
99
# Create and switch to branch: release-YY.M.
1010
./release/create-release-branch.sh -b YY.M -w products
1111
./release/create-release-branch.sh -b YY.M -w operators
12+
./release/create-release-branch.sh -b YY.M -w cockpit
1213
./release/create-release-branch.sh -b YY.M -w demos
1314

1415
# Clone to /tmp/stackable-release-YY.M/docker-images and/or enter the directory.
@@ -20,11 +21,13 @@ It is a good idea to do a dry-run check locally, and then delete the local state
2021
# Raise a PR (dry-run).
2122
./release/create-release-candidate-branch.sh -t YY.M.X-rc1 -w products
2223
./release/create-release-candidate-branch.sh -t YY.M.X-rc1 -w operators
24+
./release/create-release-candidate-branch.sh -t YY.M.X-rc1 -w cockpit
2325

2426
# Pretend the PR exists, and exit.
2527
# This doesn't really test much.
2628
./release/merge-release-candidate.sh -t YY.M.X-rc1 -w products
2729
./release/merge-release-candidate.sh -t YY.M.X-rc1 -w operators
30+
./release/merge-release-candidate.sh -t YY.M.X-rc1 -w cockpit
2831

2932
# Clone to /tmp/stackable-release-YY.M/docker-images and/or enter the directory.
3033
# Fetch and switch to branch: release-YY.M.
@@ -33,6 +36,7 @@ It is a good idea to do a dry-run check locally, and then delete the local state
3336
# Tag the HEAD commit (in this case it would be the same as `main` where this branch was based).
3437
./release/tag-release-candidate.sh -t YY.M.X-rc1 -w products
3538
./release/tag-release-candidate.sh -t YY.M.X-rc1 -w operators
39+
./release/tag-release-candidate.sh -t YY.M.X-rc1 -w cockpit
3640

3741
# TODO: ./release/post-release.sh
3842
```
@@ -55,6 +59,7 @@ This procedure would be done until a viable release-candidate can be selected.
5559
# Push the branch.
5660
./release/create-release-branch.sh -b YY.M -w products -p
5761
./release/create-release-branch.sh -b YY.M -w operators -p
62+
./release/create-release-branch.sh -b YY.M -w cockpit -p
5863
./release/create-release-branch.sh -b YY.M -w demos -p
5964

6065
# Clone to /tmp/stackable-release-YY.M/docker-images and/or enter the directory.
@@ -65,6 +70,7 @@ This procedure would be done until a viable release-candidate can be selected.
6570
# Raise a PR.
6671
./release/create-release-candidate-branch.sh -t YY.M.X-rc1 -w products -p
6772
./release/create-release-candidate-branch.sh -t YY.M.X-rc1 -w operators -p
73+
./release/create-release-candidate-branch.sh -t YY.M.X-rc1 -w cockpit -p
6874
```
6975

7076
Ask people to do approvals.
@@ -80,6 +86,7 @@ Once all approvals are done, merge the changes and tag the release branch `HEAD`
8086
# Merge the PR (this does not seem to wait for checks to complete).
8187
./release/merge-release-candidate.sh -t YY.M.X-rc1 -w products -p
8288
./release/merge-release-candidate.sh -t YY.M.X-rc1 -w operators -p
89+
./release/merge-release-candidate.sh -t YY.M.X-rc1 -w cockpit -p
8390
```
8491

8592
It is still worth checking that all PRs are merged.
@@ -94,6 +101,7 @@ It is still worth checking that all PRs are merged.
94101
# Push tag.
95102
./release/tag-release-candidate.sh -t YY.M.X-rc1 -w products -p
96103
./release/tag-release-candidate.sh -t YY.M.X-rc1 -w operators -p
104+
./release/tag-release-candidate.sh -t YY.M.X-rc1 -w cockpit -p
97105
```
98106

99107
> [!CAUTION]
@@ -123,6 +131,7 @@ Once the release candidate has been deemed good, do the release proper:
123131
# Raise a PR.
124132
./release/create-release-candidate-branch.sh -t YY.M.X -w products -p
125133
./release/create-release-candidate-branch.sh -t YY.M.X -w operators -p
134+
./release/create-release-candidate-branch.sh -t YY.M.X -w cockpit -p
126135
```
127136

128137
Ask people to do approvals.
@@ -138,6 +147,7 @@ Once all approvals are done, merge the changes and tag the release branch `HEAD`
138147
# Merge the PR (this does not seem to wait for checks to complete).
139148
./release/merge-release-candidate.sh -t YY.M.X -w products -p
140149
./release/merge-release-candidate.sh -t YY.M.X -w operators -p
150+
./release/merge-release-candidate.sh -t YY.M.X -w cockpit -p
141151

142152
# Clone to /tmp/stackable-release-YY.M/docker-images and/or enter the directory.
143153
# Fetch, including tags.
@@ -148,6 +158,7 @@ Once all approvals are done, merge the changes and tag the release branch `HEAD`
148158
# Push tag.
149159
./release/tag-release-candidate.sh -t YY.M.X -w products -p
150160
./release/tag-release-candidate.sh -t YY.M.X -w operators -p
161+
./release/tag-release-candidate.sh -t YY.M.X -w cockpit -p
151162
```
152163

153164
> [!CAUTION]

‎release/README.md‎

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,16 @@ These steps are repeated for each release tag i.e. for both release-candidates a
4141
# build failures are not yet sent to the #notifications-container-images channel yet.
4242
# repeat the above with e.g. the tag 25.3.0 once a release candidate is accepted.
4343

44+
# continue with cockpit ...
45+
# same flow as the operators: branch, RC PR, merge, tag
46+
./release/create-release-branch.sh -b 25.3 -w cockpit # Only add the -p flag after testing locally first
47+
./release/create-release-candidate-branch.sh -t 25.3.0-rc1 -w cockpit # Only add the -p flag after testing locally first
48+
./release/merge-release-candidate.sh -t 25.3.0-rc1 -w cockpit # Only add the -p flag after testing locally first
49+
./release/tag-release-candidate.sh -t 25.3.0-rc1 -w cockpit # Only add the -p flag after testing locally first
50+
51+
# monitor the GH action that builds the cockpit image and Helm chart for success.
52+
# repeat the above with e.g. the tag 25.3.0 once a release candidate is accepted.
53+
4454
# continue with the demos ...
4555
# create and push the release branch (demos are intentionally branch-only:
4656
# no RC branches, no tagging, no post-release steps)
@@ -112,14 +122,15 @@ A set of scripts that automates some release steps. The release process has mult
112122
4. Call `tag-release-candidate.sh` - This will:
113123
- tag merge commit from above, triggering github actions to build the product images and operators
114124
5. Call `post-release.sh`- This will:
115-
- update the operator CHANGELOG.md in `main` with changes from the release tag
116-
- create PRs for all operators
125+
- update the operator and cockpit CHANGELOG.md in `main` with changes from the release tag
126+
- create PRs for all operators and cockpit
117127

118128
> [!NOTE]
119129
120130
> - Steps 2-4 will check out the release branch (or clone it if does exist locally) and so can be run independently of each other.
121131
> - Any changes should be done manually between steps 2 and 3 i.e. by making changes in the PR branch and/or cherry-picking commits from main.
122132
> - Demos only require step 1 (branch creation). They are intentionally not tagged or given release candidates.
133+
> - Cockpit follows the same steps as the operators.
123134
124135
## Install requirements
125136

@@ -142,6 +153,10 @@ cargo install cargo-edit --version 0.12.3
142153

143154
This script requires <https://github.com/mikefarah/yq> (not to be confused with <https://github.com/kislyuk/yq>).
144155

156+
### jaq (json parser)
157+
158+
This script requires <https://github.com/01mf02/jaq> to edit JSON files in place, which `jq` can't do.
159+
145160
### gh (github client)
146161

147162
This script requires <https://github.com/cli> to be installed.
@@ -163,13 +178,13 @@ pipx inject jinja2-cli pyyaml
163178
To create release branches use the `create-release-branch.sh` script, called from the repository root folder. The syntax is given below:
164179

165180
```shell
166-
./release/create-release-branch.sh -b <release> [-p] [-c] [-w products|operators|demos|all]
181+
./release/create-release-branch.sh -b <release> [-p] [-c] [-w products|operators|cockpit|demos|all]
167182
```
168183

169184
- `-b <release>`: the release number (mandatory). This must be a semver-compatible value (i.e. without leading zeros) such as `23.1`, `23.10` etc. and will be used to create a branch with the name `release-<release>` e.g. `release-23.1`.
170185
- `-p`: push flag (optional, default is "false"). If provided, the created branches plus any changes made as part of this process will be pushed to the origin.
171186
- `-c`: cleanup flag (optional, default is "false"). If provided, the repository folders will be torn down on completion.
172-
- `-w`: where to create the branch. It can be "products", "operators", "demos" or "all".
187+
- `-w`: where to create the branch. It can be "products", "operators", "cockpit", "demos" or "all".
173188

174189
N.B. the flags cannot be combined (e.g. `-p -c` but not `-pc)
175190

@@ -192,13 +207,13 @@ e.g.
192207
To create release tags use the `create-release-candidate-branch.sh` script, called from the repository root folder. The syntax is given below:
193208

194209
```shell
195-
./release/create-release-candidate-branch.sh -t <release-tag> [-p] [-c] [-w products|operators|all]
210+
./release/create-release-candidate-branch.sh -t <release-tag> [-p] [-c] [-w products|operators|cockpit|all]
196211
```
197212

198213
- `-t <release-tag>`: the release tag (mandatory). This must be a semver-compatible value (i.e. major/minor/path, without leading zeros) such as `23.1.0`, `23.10.3-rc1` etc. and will be used to create a tag with the name.
199214
- `-p`: push flag (optional, default is "false"). If provided, the changes and PRs made as part of this process will be pushed to the origin.
200215
- `-c`: cleanup flag (optional, default is "false"). If provided, the repository folders will be torn down on completion.
201-
- `-w`: where to create the tag and update versions in code. It can be "products", "operators" or "all".
216+
- `-w`: where to create the tag and update versions in code. It can be "products", "operators", "cockpit" or "all".
202217

203218
N.B. the flags cannot be combined (e.g. `-p -c` but not `-pc)
204219

@@ -220,6 +235,7 @@ e.g.
220235
- update the `release-tag` in helm charts
221236
- rebuilds the helm charts
222237
- bumps the changelog
238+
- for cockpit: sets the version in `package.json`, `package-lock.json` and the Helm `Chart.yaml` instead of updating `Cargo.toml` and rebuilding the Helm charts; `docs/antora.yml` and the changelog are updated like for the operators
223239
- optional: pushes the new branch (if requested with "-p")
224240
- optional: deletes the temporary folder (if requested with "-c")
225241

@@ -233,12 +249,12 @@ Product and operator images will be built when these PRs are created or updated,
233249
To merge PRs use the `merge-release-candidate.sh` script, called from the repository root folder. The syntax is given below:
234250

235251
```shell
236-
./release/merge-release-candidate.sh -t <release-tag> [-p] [-w products|operators|all]
252+
./release/merge-release-candidate.sh -t <release-tag> [-p] [-w products|operators|cockpit|all]
237253
```
238254

239255
- `-t <release-tag>`: the release tag (mandatory). This must be a semver-compatible value (i.e. major/minor/path, without leading zeros) such as `23.1.0`, `23.10.3-rc1` etc. and will be used to identify the PR (which was created using this tag).
240256
- `-p`: push flag (optional, default is "false"). If provided, the PRs will be approved and merged.
241-
- `-w`: where to create the tag and update versions in code. It can be "products", "operators" or "all".
257+
- `-w`: where to create the tag and update versions in code. It can be "products", "operators", "cockpit" or "all".
242258

243259
e.g.
244260

@@ -259,13 +275,13 @@ e.g.
259275
The final step is to tag the merge commit from above: this is done using the `tag-release-candidate.sh` script, called from the repository root folder. The syntax is given below:
260276

261277
```shell
262-
./release/tag-release-candidate.sh -t <release-tag> [-p] [-c] [-w products|operators|all]
278+
./release/tag-release-candidate.sh -t <release-tag> [-p] [-c] [-w products|operators|cockpit|all]
263279
```
264280

265281
- `-t <release-tag>`: the release tag (mandatory). This must be a semver-compatible value (i.e. major/minor/path, without leading zeros) such as `23.1.0`, `23.10.3-rc1` etc. and will be used to create a tag with the name.
266282
- `-p`: push flag (optional, default is "false"). If provided, the created commits and tags made as part of this process will be pushed to the origin.
267283
- `-c`: cleanup flag (optional, default is "false"). If provided, the repository folders will be torn down on completion.
268-
- `-w`: where to create the tag and update versions in code. It can be "products", "operators" or "all".
284+
- `-w`: where to create the tag and update versions in code. It can be "products", "operators", "cockpit" or "all".
269285

270286
#### What this script does
271287

@@ -281,19 +297,20 @@ The final step is to tag the merge commit from above: this is done using the `ta
281297
Some post release steps are performed with `release/post-release.sh` script, called from the repository root folder. The syntax is given below:
282298

283299
```shell
284-
./release/post-release.sh -t <release-tag> [-p] [-w products|operators|all]
300+
./release/post-release.sh -t <release-tag> [-p] [-w products|operators|cockpit|all]
285301
```
286302

287303
- `-t <release-tag>`: the release tag (mandatory). This must be a semver-compatible value (i.e. major/minor/path, without leading zeros) such as `23.1.0`, `23.10.3` etc. and will be used to create a tag with the name.
288304
- `-p`: push flag (optional, default is "false"). If provided, the created commits and tags made as part of this process will be pushed to the origin.
289-
- `-w`: which repositories to update the changelogs for. It can be "products", "operators", "all" (defaults to "all").
305+
- `-w`: which repositories to update the changelogs for. It can be "products", "operators", "cockpit", "all" (defaults to "all").
290306

291307
#### What this script does
292308

293309
- checks that the release tag exists and that all operator repositories have a clean working copy
294310
- checks that the release tag exists and that the docker-images repository has a clean working copy
295311
- merges the CHANGELOG.md from the release tag into main
296312
- creates PRs for all operators
313+
- does the same for the cockpit repository
297314

298315
## Build actions
299316

@@ -325,6 +342,10 @@ on:
325342
...
326343
```
327344

345+
### Cockpit image and Helm chart
346+
347+
The cockpit image and Helm chart are built by `build.yaml` in the cockpit repository when a matching tag is pushed. The tag filter there must accept CalVer tags (two-digit year, e.g. `26.3.0`), otherwise tagging builds nothing.
348+
328349
## Post-release steps
329350

330351
Once the release is complete and all steps above have been verified, the documentation needs to be updated and built. This is done in a separate suite of scripts found https://github.com/stackabletech/documentation/tree/main/scripts[here]. Follow the steps given in the two scripts (there are prompts provided which allow for early-exit if things are not as they should be!).

‎release/common.sh‎

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,16 @@ verify_release() {
103103
fi
104104
fi
105105

106+
# package.json version (cockpit)
107+
if [ -f "$dir/package.json" ]; then
108+
local package_ver
109+
package_ver=$(jaq -r '.version' "$dir/package.json")
110+
if [ "$package_ver" != "$tag" ]; then
111+
>&2 echo " FAIL: package.json version is '$package_ver', expected '$tag'"
112+
errors=$((errors + 1))
113+
fi
114+
fi
115+
106116
# Helm Chart.yaml version and appVersion
107117
local chart_yaml
108118
chart_yaml=$(find "$dir/deploy/helm" -maxdepth 2 -name "Chart.yaml" -print -quit 2>/dev/null || true)
@@ -252,6 +262,9 @@ check_common_dependencies() {
252262

253263
# yq (YAML processor) - https://github.com/mikefarah/yq
254264
yq --version
265+
266+
# jaq (JSON processor) - https://github.com/01mf02/jaq
267+
jaq --version
255268
}
256269

257270
# CalVer base pattern: YY.M where month is 1-12 without leading zero.
@@ -334,7 +347,7 @@ validate_release_base_version() {
334347
# Derive common variables from a release tag.
335348
# Requires $INITIAL_DIR to be set (for reading config.yaml).
336349
#
337-
# Sets: RELEASE_BASE, RELEASE_BRANCH, PR_BRANCH, DOCKER_IMAGES_REPO, TEMP_RELEASE_FOLDER
350+
# Sets: RELEASE_BASE, RELEASE_BRANCH, PR_BRANCH, DOCKER_IMAGES_REPO, COCKPIT_REPO, TEMP_RELEASE_FOLDER
338351
#
339352
# Usage:
340353
# INITIAL_DIR="$PWD"
@@ -346,13 +359,14 @@ derive_tag_vars() {
346359
RELEASE_BRANCH="release-$RELEASE_BASE" # e.g., release-26.3
347360
PR_BRANCH="pr-$tag" # e.g., pr-26.3.0-rc1
348361
DOCKER_IMAGES_REPO=$(yq '... comments="" | .images-repo ' "$INITIAL_DIR"/release/config.yaml)
362+
COCKPIT_REPO=$(yq '... comments="" | .cockpit-repo ' "$INITIAL_DIR"/release/config.yaml)
349363
TEMP_RELEASE_FOLDER="/tmp/stackable-$RELEASE_BRANCH"
350364
}
351365

352366
# Derive common variables from a release base version (YY.M).
353367
# Requires $INITIAL_DIR to be set (for reading config.yaml).
354368
#
355-
# Sets: RELEASE_BRANCH, DOCKER_IMAGES_REPO, DEMOS_REPO, TEMP_RELEASE_FOLDER
369+
# Sets: RELEASE_BRANCH, DOCKER_IMAGES_REPO, DEMOS_REPO, COCKPIT_REPO, TEMP_RELEASE_FOLDER
356370
#
357371
# Usage:
358372
# INITIAL_DIR="$PWD"
@@ -363,6 +377,7 @@ derive_branch_vars() {
363377
RELEASE_BRANCH="release-$release_base" # e.g., release-26.3
364378
DOCKER_IMAGES_REPO=$(yq '... comments="" | .images-repo ' "$INITIAL_DIR"/release/config.yaml)
365379
DEMOS_REPO=$(yq '... comments="" | .demos-repo ' "$INITIAL_DIR"/release/config.yaml)
380+
COCKPIT_REPO=$(yq '... comments="" | .cockpit-repo ' "$INITIAL_DIR"/release/config.yaml)
366381
TEMP_RELEASE_FOLDER="/tmp/stackable-$RELEASE_BRANCH"
367382
}
368383

‎release/config.yaml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
demos-repo: demos
33
images-repo: docker-images
4+
cockpit-repo: cockpit
45
operators:
56
- airflow-operator
67
- commons-operator

‎release/create-release-branch.sh‎

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,17 @@ update_operator() (
3838
push_branch "$operator"
3939
)
4040

41+
update_cockpit() (
42+
ensure_clone "$COCKPIT_REPO" "--branch main"
43+
cd "$COCKPIT_REPO"
44+
assert_cwd_is_repo "$COCKPIT_REPO"
45+
assert_clean_index "$COCKPIT_REPO"
46+
git pull && git switch "${RELEASE_BRANCH}" 2> /dev/null || git switch -c "${RELEASE_BRANCH}"
47+
assert_on_branch "$RELEASE_BRANCH"
48+
assert_remote_exists "$REMOTE" "$COCKPIT_REPO"
49+
push_branch "$COCKPIT_REPO"
50+
)
51+
4152
update_demos() (
4253
ensure_clone "$DEMOS_REPO" "--branch main"
4354
cd "$DEMOS_REPO"
@@ -61,10 +72,12 @@ update_repos() {
6172
case "$WHAT" in
6273
products) update_products ;;
6374
operators) for_each_operator update_operator ;;
75+
cockpit) update_cockpit ;;
6476
demos) update_demos ;;
6577
all)
6678
update_products
6779
for_each_operator update_operator
80+
update_cockpit
6881
update_demos
6982
;;
7083
esac
@@ -119,12 +132,12 @@ main() {
119132
parse_inputs "$@"
120133

121134
if [ -z "${RELEASE_BASE}" ]; then
122-
>&2 echo "Usage: create-release-branch.sh -b <branch> [-p] [-c] [-w products|operators|demos|all]"
135+
>&2 echo "Usage: create-release-branch.sh -b <branch> [-p] [-c] [-w products|operators|cockpit|demos|all]"
123136
exit 1
124137
fi
125138

126139
validate_release_base_version "$RELEASE_BASE"
127-
validate_what "$WHAT" "products" "operators" "demos" "all"
140+
validate_what "$WHAT" "products" "operators" "cockpit" "demos" "all"
128141
check_common_dependencies
129142

130143
ensure_temp_folder

0 commit comments

Comments
 (0)