Skip to content

Commit 507d9a5

Browse files
Use set -x instead of die
1 parent 5deaf66 commit 507d9a5

File tree

1 file changed

+17
-19
lines changed

1 file changed

+17
-19
lines changed

go-modules-update.sh

+17-19
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,8 @@
3535
# - This script doesn't handle interface incompatibility of updates.
3636

3737

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

4341
MAX_RETRY=10
4442

@@ -56,18 +54,18 @@ while getopts ":u:v:" option; do
5654
done
5755

5856
# Only need to do this once
59-
gh auth login || die "gh auth login failed"
57+
gh auth login
6058

6159
while read -r repo branches; do
6260
if [ "$repo" != "#" ]; then
6361
(
64-
cd "$repo" || die "$repo: does not exit"
65-
git fetch origin || die "$repo: git fetch"
62+
cd "$repo"
63+
git fetch origin
6664
for i in $branches; do
6765
if [ "$(git rev-parse --verify "module-update-$i" 2>/dev/null)" ]; then
6866
git checkout master && git branch -d "module-update-$i"
6967
fi
70-
git checkout -B "module-update-$i" "origin/$i" || die "$repo:$i checkout"
68+
git checkout -B "module-update-$i" "origin/$i"
7169
rm -rf .git/MERGE*
7270
if ! git subtree pull --squash --prefix=release-tools https://github.com/kubernetes-csi/csi-release-tools.git master; then
7371
# Sometimes "--squash" leads to merge conflicts. Because we know that "release-tools"
@@ -76,11 +74,11 @@ while read -r repo branches; do
7674
if [ -e .git/MERGE_MSG ] && [ -e .git/FETCH_HEAD ] && grep -q "^# Conflict" .git/MERGE_MSG; then
7775
rm -rf release-tools
7876
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"
77+
git archive FETCH_HEAD | tar -C release-tools -xf -
78+
git add release-tools
79+
git commit --file=.git/MERGE_MSG
8280
else
83-
die "git subtree pull --squash failed, cannot reover."
81+
exit 1
8482
fi
8583
fi
8684
RETRY=0
@@ -89,12 +87,12 @@ while read -r repo branches; do
8987
RETRY=$((RETRY+1))
9088
go mod tidy && go mod vendor && go mod tidy
9189
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"
90+
go mod tidy && go mod vendor && go mod tidy
91+
git add --all
92+
git commit -m "Update dependency go modules for k8s v$v"
93+
git remote set-url origin "https://github.com/$username/$repo.git"
94+
make test
95+
git push origin "module-update-$i" --force
9896
# Create PR
9997
prbody=$(cat <<EOF
10098
Ran kubernetes-csi/csi-release-tools go-get-kubernetes.sh -p ${v}.
@@ -107,7 +105,7 @@ EOF
107105
)
108106
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"
109107
done
110-
) || die "failed"
108+
)
111109
fi
112110
done <<EOF
113111
csi-driver-host-path master

0 commit comments

Comments
 (0)