Skip to content

Commit 97a4899

Browse files
authored
Merge pull request #180 from pohly/prow-update-master
master: update release-tools
2 parents 51a6f06 + 6f78116 commit 97a4899

File tree

2 files changed

+33
-4
lines changed

2 files changed

+33
-4
lines changed

release-tools/go-get-kubernetes.sh

+32-3
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,43 @@ set -o pipefail
2626
cmd=$0
2727

2828
function help () {
29-
echo "$cmd <kubernetes version = x.y.z> - update all components from kubernetes/kubernetes to that version"
29+
cat <<EOF
30+
$cmd -p <kubernetes version = x.y.z>
31+
32+
Update all components from kubernetes/kubernetes to that version.
33+
34+
By default, replace statements are added for all Kubernetes packages,
35+
whether they are used or not. This is useful when preparing a
36+
repository for using k8s.io/kubernetes, because those replace
37+
statements are needed to avoid "unknown revision v0.0.0" errors
38+
(https://github.com/kubernetes/kubernetes/issues/79384).
39+
40+
With the optional -p flag, all unused replace statements are
41+
pruned. This makes go.mod smaller, but isn't required.
42+
43+
The replace statements are needed for "go get -u ./..." which
44+
otherwise ends up updating Kubernetes packages like client-go to
45+
incompatible versions (in that case, a very old 1.x release which
46+
happens to have a "higher" version number than the current
47+
0.<Kubernetes minor version>.<Kubernetes patch version> numbers.
48+
EOF
3049
}
3150

51+
prune=false
52+
53+
while getopts "ph" o; do
54+
case "$o" in
55+
h) help; exit 0;;
56+
p) prune=true;;
57+
*) help; exit 1;;
58+
esac
59+
done
60+
shift $((OPTIND-1))
61+
3262
if [ $# -ne 1 ]; then
3363
help
3464
exit 1
3565
fi
36-
case "$1" in -h|--help|help) help; exit 0;; esac
3766

3867
die () {
3968
echo >&2 "$@"
@@ -55,7 +84,7 @@ mods=$( (set -x; curl --silent --show-error --fail "https://raw.githubuserconten
5584
sed -n 's|.*k8s.io/\(.*\) => ./staging/src/k8s.io/.*|k8s.io/\1|p'
5685
) || die "failed to determine Kubernetes staging modules"
5786
for mod in $mods; do
58-
if ! (env GO111MODULE=on go mod graph) | grep "$mod@" > /dev/null; then
87+
if $prune && ! (env GO111MODULE=on go mod graph) | grep "$mod@" > /dev/null; then
5988
echo "Kubernetes module $mod is not used, skipping"
6089
# Remove the module from go.mod "replace" that was added by an older version of this script.
6190
(set -x; env GO111MODULE=on go mod edit "-dropreplace=$mod") || die "'go mod edit' failed"

release-tools/prow.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ configvar CSI_PROW_BUILD_PLATFORMS "linux amd64; linux ppc64le -ppc64le; linux s
8686
# which is disabled with GOFLAGS=-mod=vendor).
8787
configvar GOFLAGS_VENDOR "$( [ -d vendor ] && echo '-mod=vendor' )" "Go flags for using the vendor directory"
8888

89-
configvar CSI_PROW_GO_VERSION_BUILD "1.16" "Go version for building the component" # depends on component's source code
89+
configvar CSI_PROW_GO_VERSION_BUILD "1.17.3" "Go version for building the component" # depends on component's source code
9090
configvar CSI_PROW_GO_VERSION_E2E "" "override Go version for building the Kubernetes E2E test suite" # normally doesn't need to be set, see install_e2e
9191
configvar CSI_PROW_GO_VERSION_SANITY "${CSI_PROW_GO_VERSION_BUILD}" "Go version for building the csi-sanity test suite" # depends on CSI_PROW_SANITY settings below
9292
configvar CSI_PROW_GO_VERSION_KIND "${CSI_PROW_GO_VERSION_BUILD}" "Go version for building 'kind'" # depends on CSI_PROW_KIND_VERSION below

0 commit comments

Comments
 (0)