Skip to content

Commit e351c0e

Browse files
authored
Merge pull request #29 from TerryHowe/prow-update-master
Prow update master
2 parents 18f1d04 + b2a04b5 commit e351c0e

File tree

756 files changed

+374138
-65
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

756 files changed

+374138
-65
lines changed

release-tools/.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
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"
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'

release-tools/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

release-tools/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

release-tools/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
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)