csi-driver-nvmf/go-modules-targeted-update.sh
Terry Howe 1fbad65d7f Squashed 'release-tools/' changes from f9d5b9c..98f2307
98f2307 Merge pull request  from TerryHowe/update-csi-driver-version
e9d8712 Merge pull request  from stmcginnis/deprecated-kind-kube-root
faf79ff Remove --kube-root deprecated kind argument
734c2b9 Merge pull request  from Rakshith-R/consider-main-branch
f95c855 Merge pull request  from huww98/golang-toolchain
3c8d966 Treat main branch as equivalent to master branch
e31de52 Merge pull request  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  from gnufied/enable-race-detection
e1ceee2 Always enable race detection while running tests
988496a Merge pull request  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  from solumath/master
cfa9210 Instruction update
379a1bb Merge pull request  from humblec/sidecar-md
a5667bb fix typo in sidecar release process
4967685 Merge pull request  from bells17/add-github-actions
d9bd160 Update skip list in codespell GitHub Action
adb3af9 Merge pull request  from bells17/update-go-version
f5aebfc Add GitHub Actions workflows
b82ee38 Merge pull request  from bells17/fix-typo
c317456 Fix typo
0a78505 Bump to Go 1.22.3
edd89ad Merge pull request  from jsafrane/add-logcheck
043fd09 Add test-logcheck target
d7535ae Merge pull request  from jsafrane/go-1.22
b52e7ad Update go to 1.22.2
14fdb6f Merge pull request  from msau42/prow
dc4d0ae Merge pull request  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  from xing-yang/go_1.21
5436c81 Change go version to 1.21.5
267b40e Merge pull request  from carlory/sig-storage
b42e5a2 nominate self (carlory) as kubernetes-csi reviewer
a17f536 Merge pull request  from sunnylovestiramisu/sidecar
011033d Use set -x instead of die
5deaf66 Add wrapper script for sidecar release
f8c8cc4 Merge pull request  from msau42/prow
b36b5bf Merge pull request  from dannawang0221/upgrade-go-version
adfddcc Merge pull request  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: 98f23071d946dd3de3188a7e1f84679067003162
2024-12-09 12:39:31 -07:00

97 lines
2.6 KiB
Bash
Executable File

#!/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: go-modules-targeted-update.sh
#
# Batch update specific 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 Github org directory (one directory above the
# repos)
# 3. Change $modules, $releases and $org if needed.
# 4. Set environment variables
# 5. Run script from the Github org 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
org="kubernetes-csi"
modules=(
"github.com/kubernetes-csi/csi-lib-utils@v0.15.1"
)
releases=(
#"external-attacher release-4.4"
#"external-provisioner release-3.6"
#"external-resizer release-1.9"
#"external-snapshotter release-6.3"
#"node-driver-registrar release-2.9"
)
for rel in "${releases[@]}"; do
read -r repo branch <<< "$rel"
if [ "$repo" != "#" ]; then
(
cd "$repo"
git fetch upstream
if [ "$(git rev-parse --verify "module-update-$branch" 2>/dev/null)" ]; then
git checkout master && git branch -D "module-update-$branch"
fi
git checkout -B "module-update-$branch" "upstream/$branch"
for mod in "${modules[@]}"; do
go get "$mod"
done
go mod tidy
go mod vendor
git add --all
git commit -m "Update go modules"
git push origin "module-update-$branch" --force
# Create PR
prbody=$(cat <<EOF
Updated the following go modules:
${modules[@]}
\`\`\`release-note
NONE
\`\`\`
EOF
)
gh pr create --title="[$branch] Update go modules" --body "$prbody" --head "$GITHUB_USER:module-update-$branch" --base "$branch" --repo="$org/$repo"
)
fi
done