35
35
# - This script doesn't handle interface incompatibility of updates.
36
36
37
37
38
- die () {
39
- echo >&2 " $@ "
40
- exit 1
41
- }
38
+ set -e
39
+ set -x
42
40
43
41
MAX_RETRY=10
44
42
@@ -56,18 +54,18 @@ while getopts ":u:v:" option; do
56
54
done
57
55
58
56
# Only need to do this once
59
- gh auth login || die " gh auth login failed "
57
+ gh auth login
60
58
61
59
while read -r repo branches; do
62
60
if [ " $repo " != " #" ]; then
63
61
(
64
- cd " $repo " || die " $repo : does not exit "
65
- git fetch origin || die " $repo : git fetch "
62
+ cd " $repo "
63
+ git fetch origin
66
64
for i in $branches ; do
67
65
if [ " $( git rev-parse --verify " module-update-$i " 2> /dev/null) " ]; then
68
66
git checkout master && git branch -d " module-update-$i "
69
67
fi
70
- git checkout -B " module-update-$i " " origin/$i " || die " $repo : $i checkout "
68
+ git checkout -B " module-update-$i " " origin/$i "
71
69
rm -rf .git/MERGE*
72
70
if ! git subtree pull --squash --prefix=release-tools https://github.com/kubernetes-csi/csi-release-tools.git master; then
73
71
# Sometimes "--squash" leads to merge conflicts. Because we know that "release-tools"
@@ -76,11 +74,11 @@ while read -r repo branches; do
76
74
if [ -e .git/MERGE_MSG ] && [ -e .git/FETCH_HEAD ] && grep -q " ^# Conflict" .git/MERGE_MSG; then
77
75
rm -rf release-tools
78
76
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
82
80
else
83
- die " git subtree pull --squash failed, cannot reover. "
81
+ exit 1
84
82
fi
85
83
fi
86
84
RETRY=0
@@ -89,12 +87,12 @@ while read -r repo branches; do
89
87
RETRY=$(( RETRY+ 1 ))
90
88
go mod tidy && go mod vendor && go mod tidy
91
89
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
98
96
# Create PR
99
97
prbody=$( cat << EOF
100
98
Ran kubernetes-csi/csi-release-tools go-get-kubernetes.sh -p ${v} .
107
105
)
108
106
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 "
109
107
done
110
- ) || die " failed "
108
+ )
111
109
fi
112
110
done << EOF
113
111
csi-driver-host-path master
0 commit comments