From 7477d7e42761d2f09b5361c832b10cc7e0f00a73 Mon Sep 17 00:00:00 2001 From: Paul Morie Date: Wed, 2 May 2018 12:50:50 -0400 Subject: [PATCH] Make it possible to skip fetch and untar of tools --- test.sh | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/test.sh b/test.sh index 7565e6a19a..5cba49d325 100755 --- a/test.sh +++ b/test.sh @@ -61,13 +61,33 @@ tmp_root=/tmp kb_root_dir=$tmp_root/kubebuilder kb_vendor_dir=$tmp_root/vendor +# Skip fetching and untaring the tools by setting the SKIP_FETCH_TOOLS variable +# in your environment to any value: +# +# $ SKIP_FETCH_TOOLS=1 ./test.sh +# +# If you skip fetching tools, this script will use the tools already on your +# machine, but rebuild the kubebuilder and kubebuilder-bin binaries. +SKIP_FETCH_TOOLS=${SKIP_FETCH_TOOLS:""} + function prepare_staging_dir { header_text "preparing staging dir" - rm -rf $kb_root_dir + + if [ -z "$SKIP_FETCH_TOOLS" ]; then + rm -rf $kb_root_dir + else + rm -f $kb_root_dir/kubebuilder/bin/kubebuilder + rm -f $kb_root_dir/kubebuilder/bin/kubebuilder-gen + rm -f $kb_root_dir/kubebuilder/bin/vendor.tar.gz + fi } # fetch k8s API gen tools and make it available under kb_root_dir/bin. function fetch_tools { + if [ -n "$SKIP_FETCH_TOOLS" ]; then + return 0 + fi + header_text "fetching tools" kb_tools_archive_name=kubebuilder-tools-$k8s_version-$goos-$goarch.tar.gz kb_tools_download_url="https://storage.googleapis.com/kubebuilder-tools/$kb_tools_archive_name" @@ -76,7 +96,7 @@ function fetch_tools { if [ ! -f $kb_tools_archive_path ]; then curl -sL ${kb_tools_download_url} -o $kb_tools_archive_path fi - tar -zxf $kb_tools_archive_path -C $tmp_root/ + tar -zvxf $kb_tools_archive_path -C $tmp_root/ } function build_kb {