Skip to content

Commit f46191d

Browse files
committed
Kubernetes master changed the way that releases are tagged, which needed
changes to kind. There are 3 changes made to prow.sh: 1. Use a master commit of kind that includes the fix for Kubernetes master. 2. Use git clone instead of git checkout (shallow) to source Kubernetes. This lets kind correctly figure out the Kubernetes release tag. 3. Build kind with make install. The kind fix was not working correctly when built with go build.
1 parent 1cac3af commit f46191d

File tree

1 file changed

+29
-23
lines changed

1 file changed

+29
-23
lines changed

prow.sh

+29-23
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ configvar CSI_PROW_GO_VERSION_GINKGO "${CSI_PROW_GO_VERSION_BUILD}" "Go version
101101
# kind version to use. If the pre-installed version is different,
102102
# the desired version is downloaded from https://github.com/kubernetes-sigs/kind/releases/download/
103103
# (if available), otherwise it is built from source.
104-
configvar CSI_PROW_KIND_VERSION v0.4.0 "kind"
104+
configvar CSI_PROW_KIND_VERSION 2555d8e09d5a77ee718414cec9f6083dfa028dc5 "kind"
105105

106106
# ginkgo test runner version to use. If the pre-installed version is
107107
# different, the desired version is built from source.
@@ -322,7 +322,7 @@ configvar CSI_PROW_E2E_ALPHA_GATES "$(get_versioned_variable CSI_PROW_E2E_ALPHA_
322322
# whether they can run with the current cluster provider, but until
323323
# they are, we filter them out by name. Like the other test selection
324324
# variables, this is again a space separated list of regular expressions.
325-
configvar CSI_PROW_E2E_SKIP 'while.kubelet.is.down.*Disruptive' "tests that need to be skipped"
325+
configvar CSI_PROW_E2E_SKIP 'Disruptive' "tests that need to be skipped"
326326

327327
# This is the directory for additional result files. Usually set by Prow, but
328328
# if not (for example, when invoking manually) it defaults to the work directory.
@@ -379,8 +379,8 @@ install_kind () {
379379
if run curl --fail --location -o "${CSI_PROW_WORK}/bin/kind" "https://github.com/kubernetes-sigs/kind/releases/download/${CSI_PROW_KIND_VERSION}/kind-linux-amd64"; then
380380
chmod u+x "${CSI_PROW_WORK}/bin/kind"
381381
else
382-
git_checkout https://github.com/kubernetes-sigs/kind "$GOPATH/src/sigs.k8s.io/kind" "${CSI_PROW_KIND_VERSION}" --depth=1 &&
383-
run_with_go "${CSI_PROW_GO_VERSION_KIND}" go build -o "${CSI_PROW_WORK}/bin/kind" sigs.k8s.io/kind
382+
git_checkout https://github.com/kubernetes-sigs/kind "${GOPATH}/src/sigs.k8s.io/kind" "${CSI_PROW_KIND_VERSION}" --depth=1 &&
383+
(cd "${GOPATH}/src/sigs.k8s.io/kind" && make install INSTALL_DIR="${CSI_PROW_WORK}/bin")
384384
fi
385385
}
386386

@@ -427,6 +427,27 @@ git_checkout () {
427427
(cd "$path" && run git clean -fdx) || die "failed to clean $path"
428428
}
429429

430+
# This clones a repo ("https://github.com/kubernetes/kubernetes")
431+
# in a certain location ("$GOPATH/src/k8s.io/kubernetes") at
432+
# a the head of a specific branch (i.e., release-1.13, master).
433+
# The directory cannot exist.
434+
git_clone_branch () {
435+
local repo path branch parent
436+
repo="$1"
437+
shift
438+
path="$1"
439+
shift
440+
branch="$1"
441+
shift
442+
443+
parent="$(dirname "$path")"
444+
mkdir -p "$parent"
445+
(cd "$parent" && run git clone --single-branch --branch "$branch" "$repo" "$path") || die "cloning $repo" failed
446+
# This is useful for local testing or when switching between different revisions in the same
447+
# repo.
448+
(cd "$path" && run git clean -fdx) || die "failed to clean $path"
449+
}
450+
430451
list_gates () (
431452
set -f; IFS=','
432453
# Ignore: Double quote to prevent globbing and word splitting.
@@ -472,25 +493,10 @@ start_cluster () {
472493
if [ "$version" = "latest" ]; then
473494
version=master
474495
fi
475-
git_checkout https://github.com/kubernetes/kubernetes "$GOPATH/src/k8s.io/kubernetes" "$version" --depth=1 || die "checking out Kubernetes $version failed"
476-
477-
# "kind build" and/or the Kubernetes build rules need at least one tag, which we don't have
478-
# when doing a shallow fetch. Therefore we fake one:
479-
# release-1.12 -> v1.12.0-release.<rev>.csiprow
480-
# latest or <revision> -> v1.14.0-<rev>.csiprow
481-
case "${CSI_PROW_KUBERNETES_VERSION}" in
482-
release-*)
483-
# Ignore: See if you can use ${variable//search/replace} instead.
484-
# shellcheck disable=SC2001
485-
tag="$(echo "${CSI_PROW_KUBERNETES_VERSION}" | sed -e 's/release-\(.*\)/v\1.0-release./')";;
486-
*)
487-
# We have to make something up. v1.0.0 did not work for some reasons.
488-
tag="v999.999.999-";;
489-
esac
490-
tag="$tag$(cd "$GOPATH/src/k8s.io/kubernetes" && git rev-list --abbrev-commit HEAD).csiprow"
491-
(cd "$GOPATH/src/k8s.io/kubernetes" && run git tag -f "$tag") || die "git tag failed"
492-
go_version="$(go_version_for_kubernetes "$GOPATH/src/k8s.io/kubernetes" "$version")" || die "cannot proceed without knowing Go version for Kubernetes"
493-
run_with_go "$go_version" kind build node-image --type bazel --image csiprow/node:latest --kube-root "$GOPATH/src/k8s.io/kubernetes" || die "'kind build node-image' failed"
496+
git_clone_branch https://github.com/kubernetes/kubernetes "${CSI_PROW_WORK}/src/kubernetes" "$version" || die "checking out Kubernetes $version failed"
497+
498+
go_version="$(go_version_for_kubernetes "${CSI_PROW_WORK}/src/kubernetes" "$version")" || die "cannot proceed without knowing Go version for Kubernetes"
499+
run_with_go "$go_version" kind build node-image --type bazel --image csiprow/node:latest --kube-root "${CSI_PROW_WORK}/src/kubernetes" || die "'kind build node-image' failed"
494500
csi_prow_kind_have_kubernetes=true
495501
fi
496502
image="csiprow/node:latest"

0 commit comments

Comments
 (0)