From 27c714652633a04acae217b0069ff208814a077a Mon Sep 17 00:00:00 2001 From: Takashi IIGUNI Date: Thu, 6 Aug 2020 05:03:06 +0000 Subject: [PATCH] ci: simplify helm path setting Download the pre-defined helm by default to make the integration test simpler. As a result, we can make PATH/TEST_HELM_PATH environment variable optional. In addition, the default helm path can be simplified that doesn't include arch and os. Signed-off-by: Takashi IIGUNI Signed-off-by: Satoru Takeuchi --- Jenkinsfile | 4 +--- tests/framework/installer/environment.go | 2 +- tests/scripts/helm.sh | 22 ++++++++++++---------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 9f66d6a72..9c08139f9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -232,9 +232,7 @@ def RunIntegrationTest(k, v) { echo "Running full regression" sh '''#!/bin/bash set -o pipefail - export PATH="/tmp/rook-tests-scripts-helm/linux-amd64:$PATH" \ - KUBECONFIG=$HOME/admin.conf \ - TEST_HELM_PATH=/tmp/rook-tests-scripts-helm/linux-amd64/helm \ + export KUBECONFIG=$HOME/admin.conf \ TEST_ENV_NAME='''+"${k}"+''' \ TEST_BASE_DIR="WORKING_DIR" \ TEST_LOG_COLLECTION_LEVEL='''+"${env.getLogs}"+''' \ diff --git a/tests/framework/installer/environment.go b/tests/framework/installer/environment.go index b337d1f7d..83b9c0971 100644 --- a/tests/framework/installer/environment.go +++ b/tests/framework/installer/environment.go @@ -22,7 +22,7 @@ import ( // testHelmPath gets the helm path func testHelmPath() string { - return getEnvVarWithDefault("TEST_HELM_PATH", "helm") + return getEnvVarWithDefault("TEST_HELM_PATH", "/tmp/rook-tests-scripts-helm/helm") } // TestLogCollectionLevel gets whether to collect all logs diff --git a/tests/scripts/helm.sh b/tests/scripts/helm.sh index 54c8c8d2d..3a88c61e4 100755 --- a/tests/scripts/helm.sh +++ b/tests/scripts/helm.sh @@ -3,7 +3,7 @@ scriptdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" temp="/tmp/rook-tests-scripts-helm" -HELM="helm" +HELM="${temp}/helm" arch="${ARCH:-}" detectArch() { @@ -27,15 +27,20 @@ detectArch() { } install() { - if ! helm_loc="$(type -p "helm")" || [[ -z ${helm_loc} ]]; then - # Download and unpack helm + # Download and unpack helm + if [ -x "${TEST_HELM_PATH}" ]; then + HELM="${TEST_HELM_PATH}" + else local dist dist="$(uname -s)" dist=$(echo "${dist}" | tr "[:upper:]" "[:lower:]") mkdir -p "${temp}" wget "https://storage.googleapis.com/kubernetes-helm/helm-v2.13.1-${dist}-${arch}.tar.gz" -O "${temp}/helm.tar.gz" - tar -C "${temp}" -zxvf "${temp}/helm.tar.gz" - HELM="${temp}/${dist}-${arch}/helm" + tar -C "${temp}" -zxvf "${temp}/helm.tar.gz" --strip-components 1 + # The following lines are workaround of a CI failure caused by the old-Jenkins-file-is-used-in-CI problem. + # These lines will be removed as soom as PR5991 is merged.. + mkdir "${temp}/${dist}-${arch}" + ln -s "${HELM}" "${temp}/${dist}-${arch}/helm" fi # set up RBAC for helm @@ -82,11 +87,8 @@ install() { } helm_reset() { - if ! helm_loc="$(type -p "helm")" || [[ -z ${helm_loc} ]]; then - local dist - dist="$(uname -s)" - dist=$(echo "${dist}" | tr "[:upper:]" "[:lower:]") - HELM="${temp}/${dist}-${arch}/helm" + if [ -x "${TEST_HELM_PATH}" ]; then + HELM="${TEST_HELM_PATH}" fi "${HELM}" reset # shellcheck disable=SC2021