From b127fe76b6fc8bd56c98c636f2d34d64d80409d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juraci=20Paix=C3=A3o=20Kr=C3=B6hling?= Date: Mon, 9 Sep 2019 14:03:50 +0200 Subject: [PATCH] Improved the install-sdk target MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Juraci Paixão Kröhling --- .ci/install-sdk.sh | 22 ++++++++++++++++++++++ Makefile | 3 +-- 2 files changed, 23 insertions(+), 2 deletions(-) create mode 100755 .ci/install-sdk.sh diff --git a/.ci/install-sdk.sh b/.ci/install-sdk.sh new file mode 100755 index 0000000000..af08aae048 --- /dev/null +++ b/.ci/install-sdk.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +DEST="${GOPATH}/bin/operator-sdk" + +function install_sdk() { + echo "Downloading the operator-sdk ${SDK_VERSION} into ${DEST}" + curl https://github.com/operator-framework/operator-sdk/releases/download/${SDK_VERSION}/operator-sdk-${SDK_VERSION}-x86_64-linux-gnu -sLo ${DEST} + chmod +x ${DEST} +} + +if [ ! -d ${GOPATH}/bin/ ]; then + mkdir -p ${GOPATH}/bin +fi + +if [ ! -f ${DEST} ]; then + install_sdk +fi + +${DEST} version | grep -q ${SDK_VERSION} +if [ $? != 0 ]; then + install_sdk +fi diff --git a/Makefile b/Makefile index a6b998e9dc..66b7e666cc 100644 --- a/Makefile +++ b/Makefile @@ -250,8 +250,7 @@ scorecard: .PHONY: install-sdk install-sdk: @echo Installing SDK ${SDK_VERSION} - @curl https://github.com/operator-framework/operator-sdk/releases/download/${SDK_VERSION}/operator-sdk-${SDK_VERSION}-x86_64-linux-gnu -sLo ${GOPATH}/bin/operator-sdk - @chmod +x ${GOPATH}/bin/operator-sdk + @SDK_VERSION=$(SDK_VERSION) GOPATH=$(GOPATH) ./.ci/install-sdk.sh .PHONY: install-tools install-tools: