forked from kubernetes-csi/csi-driver-iscsi
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Squashed 'release-tools/' changes from 670bb0ef..b54c1ba4
b54c1ba4 Merge pull request kubernetes-csi#246 from xing-yang/go_1.21 5436c81e Change go version to 1.21.5 267b40e9 Merge pull request kubernetes-csi#244 from carlory/sig-storage b42e5a2d nominate self (carlory) as kubernetes-csi reviewer a17f536f Merge pull request kubernetes-csi#210 from sunnylovestiramisu/sidecar 011033de Use set -x instead of die 5deaf667 Add wrapper script for sidecar release f8c8cc4c Merge pull request kubernetes-csi#237 from msau42/prow b36b5bfd Merge pull request kubernetes-csi#240 from dannawang0221/upgrade-go-version adfddcc9 Merge pull request kubernetes-csi#243 from pohly/git-subtree-pull-fix c4650889 pull-test.sh: avoid "git subtree pull" error 7b175a1e Update csi-test version to v5.2.0 987c90cc Update go version to 1.21 to match k/k 2c625d41 Add script to generate patch release notes f9d5b9c0 Merge pull request kubernetes-csi#236 from mowangdk/feature/bump_csi-driver-host-path_version b01fd537 Bump csi-driver-host-path version up to v1.12.0 984feece Merge pull request kubernetes-csi#234 from siddhikhapare/csi-tools 1f7e6059 fixed broken links of testgrid dashboard de2fba88 Merge pull request kubernetes-csi#233 from andyzhangx/andyzhangx-patch-1 cee895e1 remove windows 20H2 build since it's EOL long time ago git-subtree-dir: release-tools git-subtree-split: b54c1ba49469d4d5d1b5d75285e8868ffe3d328f
- Loading branch information
1 parent
ffbfd04
commit 159c9a0
Showing
6 changed files
with
283 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
#!/bin/bash | ||
|
||
# Copyright 2023 The Kubernetes Authors. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
|
||
# Usage: generate_patch_release_notes.sh | ||
# | ||
# Generates and creates PRs for kubernetes-csi patch releases. | ||
# | ||
# Required environment variables | ||
# CSI_RELEASE_TOKEN: Github token needed for generating release notes | ||
# GITHUB_USER: Github username to create PRs with | ||
# | ||
# Instructions: | ||
# 1. Login with "gh auth login" | ||
# 2. Copy this script to the kubernetes-csi directory (one directory above the | ||
# repos) | ||
# 3. Update the repos and versions in the $releases array | ||
# 4. Set environment variables | ||
# 5. Run script from the kubernetes-csi directory | ||
# | ||
# Caveats: | ||
# - This script doesn't handle regenerating and updating existing PRs yet. | ||
# It might work if you comment out the PR creation line | ||
|
||
set -e | ||
set -x | ||
|
||
releases=( | ||
# "external-attacher 4.4.1" | ||
# "external-provisioner 3.6.1" | ||
# "external-snapshotter 6.2.3" | ||
) | ||
|
||
function gen_patch_relnotes() { | ||
rm out.md || true | ||
rm -rf /tmp/k8s-repo || true | ||
GITHUB_TOKEN="$CSI_RELEASE_TOKEN" \ | ||
release-notes --discover=patch-to-latest --branch="$2" \ | ||
--org=kubernetes-csi --repo="$1" \ | ||
--required-author="" --markdown-links --output out.md | ||
} | ||
|
||
for rel in "${releases[@]}"; do | ||
read -r repo version <<< "$rel" | ||
|
||
# Parse minor version | ||
minorPattern="(^[[:digit:]]+\.[[:digit:]]+)\." | ||
[[ "$version" =~ $minorPattern ]] | ||
minor="${BASH_REMATCH[1]}" | ||
|
||
echo "$repo" "$version" "$minor" | ||
|
||
pushd "$repo/CHANGELOG" | ||
|
||
git fetch upstream | ||
|
||
# Create branch | ||
branch="changelog-release-$minor" | ||
git checkout master | ||
git branch -D "$branch" || true | ||
git checkout --track "upstream/release-$minor" -b "$branch" | ||
|
||
# Generate release notes | ||
gen_patch_relnotes "$repo" "release-$minor" | ||
cat > tmp.md <<EOF | ||
# Release notes for v$version | ||
[Documentation](https://kubernetes-csi.github.io) | ||
EOF | ||
|
||
cat out.md >> tmp.md | ||
echo >> tmp.md | ||
|
||
file="CHANGELOG-$minor.md" | ||
cat "$file" >> tmp.md | ||
mv tmp.md "$file" | ||
|
||
git add -u | ||
git commit -m "Add changelog for $version" | ||
git push -f origin "$branch" | ||
|
||
# Create PR | ||
prbody=$(cat <<EOF | ||
\`\`\`release-note | ||
NONE | ||
\`\`\` | ||
EOF | ||
) | ||
gh pr create --title="Changelog for v$version" --body "$prbody" --head "$GITHUB_USER:$branch" --base "release-$minor" --repo="kubernetes-csi/$repo" | ||
|
||
popd | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
#!/bin/sh | ||
|
||
# Copyright 2023 The Kubernetes Authors. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
|
||
# Usage: go-modules-update.sh | ||
# | ||
# Batch update dependencies for sidecars. | ||
# | ||
# Required environment variables | ||
# CSI_RELEASE_TOKEN: Github token needed for generating release notes | ||
# GITHUB_USER: Github username to create PRs with | ||
# | ||
# Instructions: | ||
# 1. Login with "gh auth login" | ||
# 2. Copy this script to the kubernetes-csi directory (one directory above the | ||
# repos) | ||
# 3. Update the repos and master branch so locally it has the latest upstream | ||
# change | ||
# 4. Set environment variables | ||
# 5. Run script from the kubernetes-csi directory | ||
# | ||
# Caveats: | ||
# - This script doesn't handle interface incompatibility of updates. | ||
# You need to resolve interface incompatibility case by case. The | ||
# most frequent case is to update the interface(new parameters, | ||
# name change of the method, etc.)in the sidecar repo and make sure | ||
# the build and test pass. | ||
|
||
|
||
set -e | ||
set -x | ||
|
||
MAX_RETRY=10 | ||
|
||
# Get the options | ||
while getopts ":u:v:" option; do | ||
case $option in | ||
u) # Set username | ||
username=$OPTARG;; | ||
v) # Set version | ||
v=$OPTARG;; | ||
\?) # Invalid option | ||
echo "Error: Invalid option: $OPTARG" | ||
exit;; | ||
esac | ||
done | ||
|
||
# Only need to do this once | ||
gh auth login | ||
|
||
while read -r repo branches; do | ||
if [ "$repo" != "#" ]; then | ||
( | ||
cd "$repo" | ||
git fetch origin | ||
for i in $branches; do | ||
if [ "$(git rev-parse --verify "module-update-$i" 2>/dev/null)" ]; then | ||
git checkout master && git branch -d "module-update-$i" | ||
fi | ||
git checkout -B "module-update-$i" "origin/$i" | ||
rm -rf .git/MERGE* | ||
if ! git subtree pull --squash --prefix=release-tools https://github.com/kubernetes-csi/csi-release-tools.git master; then | ||
# Sometimes "--squash" leads to merge conflicts. Because we know that "release-tools" | ||
# is an unmodified copy of csi-release-tools, we can automatically resolve that | ||
# by replacing it completely. | ||
if [ -e .git/MERGE_MSG ] && [ -e .git/FETCH_HEAD ] && grep -q "^# Conflict" .git/MERGE_MSG; then | ||
rm -rf release-tools | ||
mkdir release-tools | ||
git archive FETCH_HEAD | tar -C release-tools -xf - | ||
git add release-tools | ||
git commit --file=.git/MERGE_MSG | ||
else | ||
exit 1 | ||
fi | ||
fi | ||
RETRY=0 | ||
while ! ./release-tools/go-get-kubernetes.sh -p "$v" && RETRY < $MAX_RETRY | ||
do | ||
RETRY=$((RETRY+1)) | ||
go mod tidy && go mod vendor && go mod tidy | ||
done | ||
go mod tidy && go mod vendor && go mod tidy | ||
git add --all | ||
git commit -m "Update dependency go modules for k8s v$v" | ||
git remote set-url origin "https://github.com/$username/$repo.git" | ||
make test | ||
git push origin "module-update-$i" --force | ||
# Create PR | ||
prbody=$(cat <<EOF | ||
Ran kubernetes-csi/csi-release-tools go-get-kubernetes.sh -p ${v}. | ||
\`\`\`release-note | ||
Update kubernetes dependencies to v${v} | ||
\`\`\` | ||
EOF | ||
) | ||
gh pr create --title="Update dependency go modules for k8s v$v" --body "$prbody" --head "$username:module-update-master" --base "master" --repo="kubernetes-csi/$repo" | ||
done | ||
) | ||
fi | ||
done <<EOF | ||
csi-driver-host-path master | ||
csi-driver-iscsi master | ||
csi-driver-nfs master | ||
csi-lib-utils master | ||
csi-proxy master | ||
csi-test master | ||
external-attacher master | ||
external-health-monitor master | ||
external-provisioner master | ||
external-resizer master | ||
external-snapshotter master | ||
livenessprobe master | ||
node-driver-registrar master | ||
EOF |
Oops, something went wrong.