Skip to content

Commit 79f34bd

Browse files
Use set -x instead of die
1 parent 5deaf66 commit 79f34bd

File tree

2 files changed

+27
-21
lines changed

2 files changed

+27
-21
lines changed

SIDECAR_RELEASE_PROCESS.md

+3
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ 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. Update dependencies for sidecars via
50+
[go-modules-update.sh](https://github.com/kubernetes-csi/csi-driver-host-path/blob/HEAD/release-tools/go-modules-update.sh),
51+
and get PRs approved and merged.
4952
1. Check that all [canary CI
5053
jobs](https://testgrid.k8s.io/sig-storage-csi-ci) are passing,
5154
and that test coverage is adequate for the changes that are going into the release.

go-modules-update.sh

+24-21
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/sh -x
1+
#!/bin/sh
22

33
# Copyright 2023 The Kubernetes Authors.
44
#
@@ -27,18 +27,21 @@
2727
# 1. Login with "gh auth login"
2828
# 2. Copy this script to the kubernetes-csi directory (one directory above the
2929
# repos)
30-
# 3. Update the repos and branches
30+
# 3. Update the repos and master branch so locally it has the latest upstream
31+
# change
3132
# 4. Set environment variables
3233
# 5. Run script from the kubernetes-csi directory
3334
#
3435
# Caveats:
3536
# - This script doesn't handle interface incompatibility of updates.
37+
# You need to resolve interface incompatibility case by case. The
38+
# most frequent case is to update the interface chage(new parameters,
39+
# name change of the method, etc.)in the sidecar repo and make sure
40+
# the build and test pass.
3641

3742

38-
die () {
39-
echo >&2 "$@"
40-
exit 1
41-
}
43+
set -e
44+
set -x
4245

4346
MAX_RETRY=10
4447

@@ -56,18 +59,18 @@ while getopts ":u:v:" option; do
5659
done
5760

5861
# Only need to do this once
59-
gh auth login || die "gh auth login failed"
62+
gh auth login
6063

6164
while read -r repo branches; do
6265
if [ "$repo" != "#" ]; then
6366
(
64-
cd "$repo" || die "$repo: does not exit"
65-
git fetch origin || die "$repo: git fetch"
67+
cd "$repo"
68+
git fetch origin
6669
for i in $branches; do
6770
if [ "$(git rev-parse --verify "module-update-$i" 2>/dev/null)" ]; then
6871
git checkout master && git branch -d "module-update-$i"
6972
fi
70-
git checkout -B "module-update-$i" "origin/$i" || die "$repo:$i checkout"
73+
git checkout -B "module-update-$i" "origin/$i"
7174
rm -rf .git/MERGE*
7275
if ! git subtree pull --squash --prefix=release-tools https://github.com/kubernetes-csi/csi-release-tools.git master; then
7376
# Sometimes "--squash" leads to merge conflicts. Because we know that "release-tools"
@@ -76,11 +79,11 @@ while read -r repo branches; do
7679
if [ -e .git/MERGE_MSG ] && [ -e .git/FETCH_HEAD ] && grep -q "^# Conflict" .git/MERGE_MSG; then
7780
rm -rf release-tools
7881
mkdir release-tools
79-
git archive FETCH_HEAD | tar -C release-tools -xf - || die "failed to re-create release-tools from FETCH_HEAD"
80-
git add release-tools || die "add release-tools"
81-
git commit --file=.git/MERGE_MSG || die "commit squashed release-tools"
82+
git archive FETCH_HEAD | tar -C release-tools -xf -
83+
git add release-tools
84+
git commit --file=.git/MERGE_MSG
8285
else
83-
die "git subtree pull --squash failed, cannot reover."
86+
exit 1
8487
fi
8588
fi
8689
RETRY=0
@@ -89,12 +92,12 @@ while read -r repo branches; do
8992
RETRY=$((RETRY+1))
9093
go mod tidy && go mod vendor && go mod tidy
9194
done
92-
go mod tidy && go mod vendor && go mod tidy || die "last go mod vendor && go mod tidy failed"
93-
git add --all || die "git add -all failed"
94-
git commit -m "Update dependency go modules for k8s v$v" || die "commit update modules"
95-
git remote set-url origin "https://github.com/$username/$repo.git" || die "git remote set-url failed"
96-
make test || die "$repo:$i make test"
97-
git push origin "module-update-$i" --force || die "origin:module-update-$i push failed - probably there is already an unmerged branch and pending PR"
95+
go mod tidy && go mod vendor && go mod tidy
96+
git add --all
97+
git commit -m "Update dependency go modules for k8s v$v"
98+
git remote set-url origin "https://github.com/$username/$repo.git"
99+
make test
100+
git push origin "module-update-$i" --force
98101
# Create PR
99102
prbody=$(cat <<EOF
100103
Ran kubernetes-csi/csi-release-tools go-get-kubernetes.sh -p ${v}.
@@ -107,7 +110,7 @@ EOF
107110
)
108111
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"
109112
done
110-
) || die "failed"
113+
)
111114
fi
112115
done <<EOF
113116
csi-driver-host-path master

0 commit comments

Comments
 (0)