@@ -18,21 +18,7 @@ set -e
18
18
19
19
hack_dir=$( dirname ${BASH_SOURCE} )
20
20
source ${hack_dir} /common.sh
21
-
22
- k8s_version=1.16.4
23
- goarch=amd64
24
- goos=" unknown"
25
-
26
- if [[ " $OSTYPE " == " linux-gnu" ]]; then
27
- goos=" linux"
28
- elif [[ " $OSTYPE " == " darwin" * ]]; then
29
- goos=" darwin"
30
- fi
31
-
32
- if [[ " $goos " == " unknown" ]]; then
33
- echo " OS '$OSTYPE ' not supported. Aborting." >&2
34
- exit 1
35
- fi
21
+ source ${hack_dir} /setup-envtest.sh
36
22
37
23
tmp_root=/tmp
38
24
kb_root_dir=$tmp_root /kubebuilder
@@ -46,40 +32,15 @@ kb_root_dir=$tmp_root/kubebuilder
46
32
# machine, but rebuild the kubebuilder and kubebuilder-bin binaries.
47
33
SKIP_FETCH_TOOLS=${SKIP_FETCH_TOOLS:- " " }
48
34
49
- # fetch k8s API gen tools and make it available under kb_root_dir/bin.
50
- function fetch_kb_tools {
51
- local dest_dir=" ${1} "
52
-
53
- # use the pre-existing version in the temporary folder if it matches our k8s version
54
- if [[ -x " ${dest_dir} /kubebuilder/bin/kube-apiserver" ]]; then
55
- version=$( " ${dest_dir} " /kubebuilder/bin/kube-apiserver --version)
56
- if [[ $version == * " ${k8s_version} " * ]]; then
57
- header_text " Using cached kubebuilder-tools from ${dest_dir} "
58
- return 0
59
- fi
60
- fi
61
-
62
- header_text " fetching tools (into '${dest_dir} ')"
63
- kb_tools_archive_name=" kubebuilder-tools-$k8s_version -$goos -$goarch .tar.gz"
64
- kb_tools_download_url=" https://storage.googleapis.com/kubebuilder-tools/$kb_tools_archive_name "
65
-
66
- kb_tools_archive_path=" $tmp_root /$kb_tools_archive_name "
67
- if [ ! -f $kb_tools_archive_path ]; then
68
- curl -sL ${kb_tools_download_url} -o " $kb_tools_archive_path "
69
- fi
70
-
71
- mkdir -p " ${dest_dir} "
72
- tar -C " ${dest_dir} " --strip-components=1 -zvxf " $kb_tools_archive_path "
73
- }
74
-
75
- header_text " using tools"
76
35
77
36
if [ -z " $SKIP_FETCH_TOOLS " ]; then
78
- fetch_kb_tools " $kb_root_dir "
79
- fetch_kb_tools " ${hack_dir} /../pkg/internal/testing/integration/assets"
37
+ header_text " fetching envtest tools"
38
+ fetch_envtest_tools " $kb_root_dir "
39
+ fetch_envtest_tools " ${hack_dir} /../pkg/internal/testing/integration/assets"
80
40
fi
81
41
82
- setup_envs
42
+ header_text " setting up envtest environment"
43
+ setup_envs " $kb_root_dir "
83
44
84
45
${hack_dir} /verify.sh
85
46
${hack_dir} /test-all.sh
0 commit comments