Skip to content

Commit cf43916

Browse files
committed
Squashed 'release-tools/' changes from f9d5b9c..f8c8cc4
f8c8cc4 Merge pull request kubernetes-csi#237 from msau42/prow b36b5bf Merge pull request kubernetes-csi#240 from dannawang0221/upgrade-go-version adfddcc Merge pull request kubernetes-csi#243 from pohly/git-subtree-pull-fix c465088 pull-test.sh: avoid "git subtree pull" error 7b175a1 Update csi-test version to v5.2.0 987c90c Update go version to 1.21 to match k/k 2c625d4 Add script to generate patch release notes git-subtree-dir: release-tools git-subtree-split: f8c8cc4
1 parent 36ca7a1 commit cf43916

File tree

4 files changed

+143
-45
lines changed

4 files changed

+143
-45
lines changed

SIDECAR_RELEASE_PROCESS.md

Lines changed: 34 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -46,54 +46,45 @@ naming convention `<hostpath-deployment-version>-on-<kubernetes-version>`.
4646
## Release Process
4747
1. Identify all issues and ongoing PRs that should go into the release, and
4848
drive them to resolution.
49-
1. Download the latest version of the
50-
[K8s release notes generator](https://github.com/kubernetes/release/tree/HEAD/cmd/release-notes)
51-
1. Create a
52-
[Github personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token)
53-
with `repo:public_repo` access
54-
1. Generate release notes for the release. Replace arguments with the relevant
55-
information.
56-
* Clean up old cached information (also needed if you are generating release
57-
notes for multiple repos)
58-
```bash
59-
rm -rf /tmp/k8s-repo
60-
```
61-
* For new minor releases on master:
62-
```bash
63-
GITHUB_TOKEN=<token> release-notes \
64-
--discover=mergebase-to-latest \
65-
--org=kubernetes-csi \
66-
--repo=external-provisioner \
67-
--required-author="" \
68-
--markdown-links \
69-
--output out.md
70-
```
71-
* For new patch releases on a release branch:
72-
```bash
73-
GITHUB_TOKEN=<token> release-notes \
74-
--discover=patch-to-latest \
75-
--branch=release-1.1 \
76-
--org=kubernetes-csi \
77-
--repo=external-provisioner \
78-
--required-author="" \
79-
--markdown-links \
80-
--output out.md
81-
```
82-
1. Compare the generated output to the new commits for the release to check if
83-
any notable change missed a release note.
84-
1. Reword release notes as needed. Make sure to check notes for breaking
85-
changes and deprecations.
86-
1. If release is a new major/minor version, create a new `CHANGELOG-<major>.<minor>.md`
87-
file. Otherwise, add the release notes to the top of the existing CHANGELOG
88-
file for that minor version.
89-
1. Submit a PR for the CHANGELOG changes.
90-
1. Submit a PR for README changes, in particular, Compatibility, Feature status,
91-
and any other sections that may need updating.
9249
1. Check that all [canary CI
9350
jobs](https://testgrid.k8s.io/sig-storage-csi-ci) are passing,
9451
and that test coverage is adequate for the changes that are going into the release.
9552
1. Check that the post-\<sidecar\>-push-images builds are succeeding.
9653
[Example](https://testgrid.k8s.io/sig-storage-image-build#post-external-snapshotter-push-images)
54+
1. Generate release notes.
55+
1. Download the latest version of the [K8s release notes generator](https://github.com/kubernetes/release/tree/HEAD/cmd/release-notes)
56+
1. Create a
57+
[Github personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token)
58+
with `repo:public_repo` access
59+
1. For patch release, use the script generate_patch_release_notes.sh. Read the instructions at the top of the
60+
script. The script also creates PRs for each branch.
61+
1. For new minor releases, follow these steps and replace arguments with the relevant
62+
information.
63+
* Clean up old cached information (also needed if you are generating release
64+
notes for multiple repos)
65+
```bash
66+
rm -rf /tmp/k8s-repo
67+
```
68+
* For new minor releases on master:
69+
```bash
70+
GITHUB_TOKEN=<token> release-notes \
71+
--discover=mergebase-to-latest \
72+
--org=kubernetes-csi \
73+
--repo=external-provisioner \
74+
--required-author="" \
75+
--markdown-links \
76+
--output out.md
77+
```
78+
1. Compare the generated output to the new commits for the release to check if
79+
any notable change missed a release note.
80+
1. Reword release notes as needed, ideally in the original PRs so that the
81+
release notes can be regnerated. Make sure to check notes for breaking
82+
changes and deprecations.
83+
1. If release is a new major/minor version, create a new `CHANGELOG-<major>.<minor>.md`
84+
file.
85+
1. Submit a PR for the CHANGELOG changes.
86+
1. Submit a PR for README changes, in particular, Compatibility, Feature status,
87+
and any other sections that may need updating.
9788
1. Make sure that no new PRs have merged in the meantime, and no PRs are in
9889
flight and soon to be merged.
9990
1. Create a new release following a previous release as a template. Be sure to select the correct

generate_patch_release_notes.sh

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
#!/bin/bash
2+
3+
# Copyright 2023 The Kubernetes Authors.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
18+
# Usage: generate_patch_release_notes.sh
19+
#
20+
# Generates and creates PRs for kubernetes-csi patch releases.
21+
#
22+
# Required environment variables
23+
# CSI_RELEASE_TOKEN: Github token needed for generating release notes
24+
# GITHUB_USER: Github username to create PRs with
25+
#
26+
# Instructions:
27+
# 1. Login with "gh auth login"
28+
# 2. Copy this script to the kubernetes-csi directory (one directory above the
29+
# repos)
30+
# 3. Update the repos and versions in the $releases array
31+
# 4. Set environment variables
32+
# 5. Run script from the kubernetes-csi directory
33+
#
34+
# Caveats:
35+
# - This script doesn't handle regenerating and updating existing PRs yet.
36+
# It might work if you comment out the PR creation line
37+
38+
set -e
39+
set -x
40+
41+
releases=(
42+
# "external-attacher 4.4.1"
43+
# "external-provisioner 3.6.1"
44+
# "external-snapshotter 6.2.3"
45+
)
46+
47+
function gen_patch_relnotes() {
48+
rm out.md || true
49+
rm -rf /tmp/k8s-repo || true
50+
GITHUB_TOKEN="$CSI_RELEASE_TOKEN" \
51+
release-notes --discover=patch-to-latest --branch="$2" \
52+
--org=kubernetes-csi --repo="$1" \
53+
--required-author="" --markdown-links --output out.md
54+
}
55+
56+
for rel in "${releases[@]}"; do
57+
read -r repo version <<< "$rel"
58+
59+
# Parse minor version
60+
minorPattern="(^[[:digit:]]+\.[[:digit:]]+)\."
61+
[[ "$version" =~ $minorPattern ]]
62+
minor="${BASH_REMATCH[1]}"
63+
64+
echo "$repo" "$version" "$minor"
65+
66+
pushd "$repo/CHANGELOG"
67+
68+
git fetch upstream
69+
70+
# Create branch
71+
branch="changelog-release-$minor"
72+
git checkout master
73+
git branch -D "$branch" || true
74+
git checkout --track "upstream/release-$minor" -b "$branch"
75+
76+
# Generate release notes
77+
gen_patch_relnotes "$repo" "release-$minor"
78+
cat > tmp.md <<EOF
79+
# Release notes for v$version
80+
81+
[Documentation](https://kubernetes-csi.github.io)
82+
83+
EOF
84+
85+
cat out.md >> tmp.md
86+
echo >> tmp.md
87+
88+
file="CHANGELOG-$minor.md"
89+
cat "$file" >> tmp.md
90+
mv tmp.md "$file"
91+
92+
git add -u
93+
git commit -m "Add changelog for $version"
94+
git push -f origin "$branch"
95+
96+
# Create PR
97+
prbody=$(cat <<EOF
98+
\`\`\`release-note
99+
NONE
100+
\`\`\`
101+
EOF
102+
)
103+
gh pr create --title="Changelog for v$version" --body "$prbody" --head "$GITHUB_USER:$branch" --base "release-$minor" --repo="kubernetes-csi/$repo"
104+
105+
popd
106+
done

prow.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ configvar CSI_PROW_BUILD_PLATFORMS "linux amd64 amd64; linux ppc64le ppc64le -pp
8686
# which is disabled with GOFLAGS=-mod=vendor).
8787
configvar GOFLAGS_VENDOR "$( [ -d vendor ] && echo '-mod=vendor' )" "Go flags for using the vendor directory"
8888

89-
configvar CSI_PROW_GO_VERSION_BUILD "1.20" "Go version for building the component" # depends on component's source code
89+
configvar CSI_PROW_GO_VERSION_BUILD "1.21" "Go version for building the component" # depends on component's source code
9090
configvar CSI_PROW_GO_VERSION_E2E "" "override Go version for building the Kubernetes E2E test suite" # normally doesn't need to be set, see install_e2e
9191
configvar CSI_PROW_GO_VERSION_SANITY "${CSI_PROW_GO_VERSION_BUILD}" "Go version for building the csi-sanity test suite" # depends on CSI_PROW_SANITY settings below
9292
configvar CSI_PROW_GO_VERSION_KIND "${CSI_PROW_GO_VERSION_BUILD}" "Go version for building 'kind'" # depends on CSI_PROW_KIND_VERSION below
@@ -240,7 +240,7 @@ configvar CSI_PROW_SIDECAR_E2E_IMPORT_PATH "none" "CSI Sidecar E2E package"
240240
# of the cluster. The alternative would have been to (cross-)compile csi-sanity
241241
# and install it inside the cluster, which is not necessarily easier.
242242
configvar CSI_PROW_SANITY_REPO https://github.com/kubernetes-csi/csi-test "csi-test repo"
243-
configvar CSI_PROW_SANITY_VERSION v5.0.0 "csi-test version"
243+
configvar CSI_PROW_SANITY_VERSION v5.2.0 "csi-test version"
244244
configvar CSI_PROW_SANITY_PACKAGE_PATH github.com/kubernetes-csi/csi-test "csi-test package"
245245
configvar CSI_PROW_SANITY_SERVICE "hostpath-service" "Kubernetes TCP service name that exposes csi.sock"
246246
configvar CSI_PROW_SANITY_POD "csi-hostpathplugin-0" "Kubernetes pod with CSI driver"

pull-test.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ CSI_RELEASE_TOOLS_DIR="$(pwd)"
2525

2626
# Update the other repo.
2727
cd "$PULL_TEST_REPO_DIR"
28+
git reset --hard # Shouldn't be necessary, but somehow is to avoid "fatal: working tree has modifications. Cannot add." (https://stackoverflow.com/questions/3623351/git-subtree-pull-says-that-the-working-tree-has-modifications-but-git-status-sa)
2829
git subtree pull --squash --prefix=release-tools "$CSI_RELEASE_TOOLS_DIR" master
2930
git log -n2
3031

0 commit comments

Comments
 (0)