Skip to content

Commit 2aa889e

Browse files
Squashed 'release-tools/' changes from 984feec..0496593
0496593 Merge pull request #268 from huww98/cloudbuild 119aee1 Merge pull request #266 from jsafrane/bump-sanity-5.3.1 0ae5e52 Update cloudbuild image with go 1.21+ 406a79a Merge pull request #267 from huww98/gomodcache 9cec273 Set GOMODCACHE to avoid re-download toolchain 98f2307 Merge pull request #260 from TerryHowe/update-csi-driver-version e9d8712 Merge pull request #259 from stmcginnis/deprecated-kind-kube-root faf79ff Remove --kube-root deprecated kind argument 734c2b9 Merge pull request #265 from Rakshith-R/consider-main-branch 43bde06 Bump csi-sanity to 5.3.1 f95c855 Merge pull request #262 from huww98/golang-toolchain 3c8d966 Treat main branch as equivalent to master branch e31de52 Merge pull request #261 from huww98/golang fd153a9 Bump golang to 1.23.1 a8b3d05 pull-test.sh: fix "git subtree pull" errors 6b05f0f use new GOTOOLCHAIN env to manage go version 18b6ac6 chore: update CSI driver version to 1.15 227577e Merge pull request #258 from gnufied/enable-race-detection e1ceee2 Always enable race detection while running tests 988496a Merge pull request #257 from jakobmoellerdev/csi-prow-sidecar-e2e-path 028f8c6 chore: bump to Go 1.22.5 69bd71e chore: add CSI_PROW_SIDECAR_E2E_PATH f40f0cc Merge pull request #256 from solumath/master cfa9210 Instruction update 379a1bb Merge pull request #255 from humblec/sidecar-md a5667bb fix typo in sidecar release process 4967685 Merge pull request #254 from bells17/add-github-actions d9bd160 Update skip list in codespell GitHub Action adb3af9 Merge pull request #252 from bells17/update-go-version f5aebfc Add GitHub Actions workflows b82ee38 Merge pull request #253 from bells17/fix-typo c317456 Fix typo 0a78505 Bump to Go 1.22.3 edd89ad Merge pull request #251 from jsafrane/add-logcheck 043fd09 Add test-logcheck target d7535ae Merge pull request #250 from jsafrane/go-1.22 b52e7ad Update go to 1.22.2 14fdb6f Merge pull request #247 from msau42/prow dc4d0ae Merge pull request #249 from jsafrane/use-go-version e681b17 Use .go-version to get Kubernetes go version 9b4352e Update release playbook c7bb972 Fix release notes script to use fixed tags 463a0e9 Add script to update specific go modules b54c1ba Merge pull request #246 from xing-yang/go_1.21 5436c81 Change go version to 1.21.5 267b40e Merge pull request #244 from carlory/sig-storage b42e5a2 nominate self (carlory) as kubernetes-csi reviewer a17f536 Merge pull request #210 from sunnylovestiramisu/sidecar 011033d Use set -x instead of die 5deaf66 Add wrapper script for sidecar release f8c8cc4 Merge pull request #237 from msau42/prow b36b5bf Merge pull request #240 from dannawang0221/upgrade-go-version adfddcc Merge pull request #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 f9d5b9c Merge pull request #236 from mowangdk/feature/bump_csi-driver-host-path_version b01fd53 Bump csi-driver-host-path version up to v1.12.0 git-subtree-dir: release-tools git-subtree-split: 04965932661b6e62709dcdbb9c25da528bac2605
1 parent 1031a3a commit 2aa889e

13 files changed

+522
-66
lines changed

.github/dependabot.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: 2
2+
enable-beta-ecosystems: true
3+
updates:
4+
- package-ecosystem: "github-actions"
5+
directory: "/"
6+
schedule:
7+
interval: "daily"
8+
labels:
9+
- "area/dependency"
10+
- "release-note-none"
11+
- "ok-to-test"
12+
open-pull-requests-limit: 10

.github/workflows/codespell.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# GitHub Action to automate the identification of common misspellings in text files.
2+
# https://github.com/codespell-project/actions-codespell
3+
# https://github.com/codespell-project/codespell
4+
name: codespell
5+
on: [push, pull_request]
6+
jobs:
7+
codespell:
8+
name: Check for spelling errors
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- uses: codespell-project/actions-codespell@master
13+
with:
14+
check_filenames: true
15+
skip: "*.png,*.jpg,*.svg,*.sum,./.git,./.github/workflows/codespell.yml,./prow.sh"

.github/workflows/trivy.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Run Trivy scanner for Go version vulnerabilities
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
jobs:
8+
trivy:
9+
name: Build
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v4
14+
15+
- name: Get Go version
16+
id: go-version
17+
run: |
18+
GO_VERSION=$(cat prow.sh | grep "configvar CSI_PROW_GO_VERSION_BUILD" | awk '{print $3}' | sed 's/"//g')
19+
echo "version=$GO_VERSION" >> $GITHUB_OUTPUT
20+
21+
- name: Run Trivy scanner for Go version vulnerabilities
22+
uses: aquasecurity/trivy-action@master
23+
with:
24+
image-ref: 'golang:${{ steps.go-version.outputs.version }}'
25+
format: 'table'
26+
exit-code: '1'
27+
ignore-unfixed: true
28+
vuln-type: 'library'
29+
severity: 'CRITICAL,HIGH,MEDIUM,LOW,UNKNOWN'

KUBERNETES_CSI_OWNERS_ALIASES

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ aliases:
1818
# when they are temporarily unable to review PRs.
1919
kubernetes-csi-reviewers:
2020
- andyzhangx
21+
- carlory
2122
- chrishenzie
2223
- ggriffiths
2324
- gnufied

SIDECAR_RELEASE_PROCESS.md

Lines changed: 40 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -46,54 +46,51 @@ 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.
49+
1. Update dependencies for sidecars
50+
1. For new minor versions, use
51+
[go-modules-update.sh](https://github.com/kubernetes-csi/csi-release-tools/blob/HEAD/go-modules-update.sh),
52+
1. For CVE fixes on patch versions, use
53+
[go-modules-targeted-update.sh](https://github.com/kubernetes-csi/csi-release-tools/blob/HEAD/go-modules-targeted-update.sh),
54+
Read the instructions at the top of the script.
9255
1. Check that all [canary CI
9356
jobs](https://testgrid.k8s.io/sig-storage-csi-ci) are passing,
9457
and that test coverage is adequate for the changes that are going into the release.
9558
1. Check that the post-\<sidecar\>-push-images builds are succeeding.
9659
[Example](https://testgrid.k8s.io/sig-storage-image-build#post-external-snapshotter-push-images)
60+
1. Generate release notes.
61+
1. Download the latest version of the [K8s release notes generator](https://github.com/kubernetes/release/tree/HEAD/cmd/release-notes)
62+
1. Create a
63+
[Github personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token)
64+
with `repo:public_repo` access
65+
1. For patch release, use the script generate_patch_release_notes.sh. Read the instructions at the top of the
66+
script. The script also creates PRs for each branch.
67+
1. For new minor releases, follow these steps and replace arguments with the relevant
68+
information.
69+
* Clean up old cached information (also needed if you are generating release
70+
notes for multiple repos)
71+
```bash
72+
rm -rf /tmp/k8s-repo
73+
```
74+
* For new minor releases on master:
75+
```bash
76+
GITHUB_TOKEN=<token> release-notes \
77+
--discover=mergebase-to-latest \
78+
--org=kubernetes-csi \
79+
--repo=external-provisioner \
80+
--required-author="" \
81+
--markdown-links \
82+
--output out.md
83+
```
84+
1. Compare the generated output to the new commits for the release to check if
85+
any notable change missed a release note.
86+
1. Reword release notes as needed, ideally in the original PRs so that the
87+
release notes can be regenerated. Make sure to check notes for breaking
88+
changes and deprecations.
89+
1. If release is a new major/minor version, create a new `CHANGELOG-<major>.<minor>.md`
90+
file.
91+
1. Submit a PR for the CHANGELOG changes.
92+
1. Submit a PR for README changes, in particular, Compatibility, Feature status,
93+
and any other sections that may need updating.
9794
1. Make sure that no new PRs have merged in the meantime, and no PRs are in
9895
flight and soon to be merged.
9996
1. Create a new release following a previous release as a template. Be sure to select the correct

build.make

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,10 @@ REV=$(shell git describe --long --tags --match='v*' --dirty 2>/dev/null || git r
4545
# Determined dynamically.
4646
IMAGE_TAGS=
4747

48-
# A "canary" image gets built if the current commit is the head of the remote "master" branch.
48+
# A "canary" image gets built if the current commit is the head of the remote "master" or "main" branch.
4949
# That branch does not exist when building some other branch in TravisCI.
5050
IMAGE_TAGS+=$(shell if [ "$$(git rev-list -n1 HEAD)" = "$$(git rev-list -n1 origin/master 2>/dev/null)" ]; then echo "canary"; fi)
51+
IMAGE_TAGS+=$(shell if [ "$$(git rev-list -n1 HEAD)" = "$$(git rev-list -n1 origin/main 2>/dev/null)" ]; then echo "canary"; fi)
5152

5253
# A "X.Y.Z-canary" image gets built if the current commit is the head of a "origin/release-X.Y.Z" branch.
5354
# The actual suffix does not matter, only the "release-" prefix is checked.
@@ -62,9 +63,9 @@ IMAGE_NAME=$(REGISTRY_NAME)/$*
6263

6364
ifdef V
6465
# Adding "-alsologtostderr" assumes that all test binaries contain glog. This is not guaranteed.
65-
TESTARGS = -v -args -alsologtostderr -v 5
66+
TESTARGS = -race -v -args -alsologtostderr -v 5
6667
else
67-
TESTARGS =
68+
TESTARGS = -race
6869
endif
6970

7071
# Specific packages can be excluded from each of the tests below by setting the *_FILTER_CMD variables
@@ -143,7 +144,7 @@ DOCKER_BUILDX_CREATE_ARGS ?=
143144
# Windows binaries can be built before adding a Dockerfile for it.
144145
#
145146
# BUILD_PLATFORMS determines which individual images are included in the multiarch image.
146-
# PULL_BASE_REF must be set to 'master', 'release-x.y', or a tag name, and determines
147+
# PULL_BASE_REF must be set to 'master', 'main', 'release-x.y', or a tag name, and determines
147148
# the tag for the resulting multiarch image.
148149
$(CMDS:%=push-multiarch-%): push-multiarch-%: check-pull-base-ref build-%
149150
set -ex; \
@@ -191,7 +192,7 @@ $(CMDS:%=push-multiarch-%): push-multiarch-%: check-pull-base-ref build-%
191192
done; \
192193
docker manifest push -p $(IMAGE_NAME):$$tag; \
193194
}; \
194-
if [ $(PULL_BASE_REF) = "master" ]; then \
195+
if [ $(PULL_BASE_REF) = "master" ] || [ $(PULL_BASE_REF) = "main" ]; then \
195196
: "creating or overwriting canary image"; \
196197
pushMultiArch canary; \
197198
elif echo $(PULL_BASE_REF) | grep -q -e 'release-*' ; then \
@@ -209,7 +210,7 @@ $(CMDS:%=push-multiarch-%): push-multiarch-%: check-pull-base-ref build-%
209210
.PHONY: check-pull-base-ref
210211
check-pull-base-ref:
211212
if ! [ "$(PULL_BASE_REF)" ]; then \
212-
echo >&2 "ERROR: PULL_BASE_REF must be set to 'master', 'release-x.y', or a tag name."; \
213+
echo >&2 "ERROR: PULL_BASE_REF must be set to 'master', 'main', 'release-x.y', or a tag name."; \
213214
exit 1; \
214215
fi
215216

@@ -322,3 +323,10 @@ test-spelling:
322323
test-boilerplate:
323324
@ echo; echo "### $@:"
324325
@ ./release-tools/verify-boilerplate.sh "$(pwd)"
326+
327+
# Test klog usage. This test is optional and must be explicitly added to `test` target in the main Makefile:
328+
# test: test-logcheck
329+
.PHONY: test-logcheck
330+
test-logcheck:
331+
@ echo; echo "### $@:"
332+
@ ./release-tools/verify-logcheck.sh

cloudbuild.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ steps:
2626
# The image must contain bash and curl. Ideally it should also contain
2727
# the desired version of Go (currently defined in release-tools/prow.sh),
2828
# but that just speeds up the build and is not required.
29-
- name: 'gcr.io/k8s-testimages/gcb-docker-gcloud:v20230623-56e06d7c18'
29+
- name: 'gcr.io/k8s-testimages/gcb-docker-gcloud:v20240718-5ef92b5c36'
3030
entrypoint: ./.cloudbuild.sh
3131
env:
3232
- GIT_TAG=${_GIT_TAG}

generate-patch-release-notes.sh

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
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+
# Required tools:
27+
# - gh
28+
# - release-notes (https://github.com/kubernetes/release/blob/master/cmd/release-notes/README.md)
29+
#
30+
# Instructions:
31+
# 1. Install the required tools
32+
# 2. Login with "gh auth login"
33+
# 3. Copy this script to the kubernetes-csi directory (one directory above the repos)
34+
# 4. Update the repos and versions in the $releases array
35+
# 5. Set environment variables
36+
# 6. Run script from the kubernetes-csi directory
37+
#
38+
# Caveats:
39+
# - This script doesn't handle regenerating and updating existing PRs yet.
40+
# It might work if you comment out the PR creation line
41+
42+
set -e
43+
set -x
44+
45+
releases=(
46+
# "external-attacher 4.4.1"
47+
# "external-provisioner 3.6.1"
48+
# "external-snapshotter 6.2.3"
49+
)
50+
51+
function gen_patch_relnotes() {
52+
rm out.md || true
53+
rm -rf /tmp/k8s-repo || true
54+
GITHUB_TOKEN="$CSI_RELEASE_TOKEN" \
55+
release-notes --start-rev="$3" --end-rev="$2" --branch="$2" \
56+
--org=kubernetes-csi --repo="$1" \
57+
--required-author="" --markdown-links --output out.md
58+
}
59+
60+
for rel in "${releases[@]}"; do
61+
read -r repo version <<< "$rel"
62+
63+
# Parse minor version
64+
minorPatchPattern="(^[[:digit:]]+\.[[:digit:]]+)\.([[:digit:]]+)"
65+
[[ "$version" =~ $minorPatchPattern ]]
66+
minor="${BASH_REMATCH[1]}"
67+
patch="${BASH_REMATCH[2]}"
68+
69+
echo "$repo $version $minor $patch"
70+
prevPatch="$((patch-1))"
71+
prevVer="v$minor.$prevPatch"
72+
73+
pushd "$repo/CHANGELOG"
74+
75+
git fetch upstream
76+
77+
# Create branch
78+
branch="changelog-release-$minor"
79+
git checkout master
80+
git branch -D "$branch" || true
81+
git checkout --track "upstream/release-$minor" -b "$branch"
82+
83+
# Generate release notes
84+
gen_patch_relnotes "$repo" "release-$minor" "$prevVer"
85+
cat > tmp.md <<EOF
86+
# Release notes for v$version
87+
88+
[Documentation](https://kubernetes-csi.github.io)
89+
90+
EOF
91+
92+
cat out.md >> tmp.md
93+
echo >> tmp.md
94+
rm out.md
95+
96+
file="CHANGELOG-$minor.md"
97+
cat "$file" >> tmp.md
98+
mv tmp.md "$file"
99+
100+
git add -u
101+
git commit -m "Add changelog for $version"
102+
git push -f origin "$branch"
103+
104+
# Create PR
105+
prbody=$(cat <<EOF
106+
\`\`\`release-note
107+
NONE
108+
\`\`\`
109+
EOF
110+
)
111+
gh pr create --title="Changelog for v$version" --body "$prbody" --head "$GITHUB_USER:$branch" --base "release-$minor" --repo="kubernetes-csi/$repo"
112+
113+
popd
114+
done

0 commit comments

Comments
 (0)