@@ -61,13 +61,33 @@ tmp_root=/tmp
61
61
kb_root_dir=$tmp_root /kubebuilder
62
62
kb_vendor_dir=$tmp_root /vendor
63
63
64
+ # Skip fetching and untaring the tools by setting the SKIP_FETCH_TOOLS variable
65
+ # in your environment to any value:
66
+ #
67
+ # $ SKIP_FETCH_TOOLS=1 ./test.sh
68
+ #
69
+ # If you skip fetching tools, this script will use the tools already on your
70
+ # machine, but rebuild the kubebuilder and kubebuilder-bin binaries.
71
+ SKIP_FETCH_TOOLS=${SKIP_FETCH_TOOLS: " " }
72
+
64
73
function prepare_staging_dir {
65
74
header_text " preparing staging dir"
66
- rm -rf $kb_root_dir
75
+
76
+ if [ -z " $SKIP_FETCH_TOOLS " ]; then
77
+ rm -rf $kb_root_dir
78
+ else
79
+ rm -f $kb_root_dir /kubebuilder/bin/kubebuilder
80
+ rm -f $kb_root_dir /kubebuilder/bin/kubebuilder-gen
81
+ rm -f $kb_root_dir /kubebuilder/bin/vendor.tar.gz
82
+ fi
67
83
}
68
84
69
85
# fetch k8s API gen tools and make it available under kb_root_dir/bin.
70
86
function fetch_tools {
87
+ if [ -n " $SKIP_FETCH_TOOLS " ]; then
88
+ return 0
89
+ fi
90
+
71
91
header_text " fetching tools"
72
92
kb_tools_archive_name=kubebuilder-tools-$k8s_version -$goos -$goarch .tar.gz
73
93
kb_tools_download_url=" https://storage.googleapis.com/kubebuilder-tools/$kb_tools_archive_name "
@@ -76,7 +96,7 @@ function fetch_tools {
76
96
if [ ! -f $kb_tools_archive_path ]; then
77
97
curl -sL ${kb_tools_download_url} -o $kb_tools_archive_path
78
98
fi
79
- tar -zxf $kb_tools_archive_path -C $tmp_root /
99
+ tar -zvxf $kb_tools_archive_path -C $tmp_root /
80
100
}
81
101
82
102
function build_kb {
0 commit comments