github.com/abayer/test-infra@v0.0.5/planter/install-bazel.sh (about) 1 #!/bin/bash 2 # Copyright 2018 The Kubernetes Authors. 3 # 4 # Licensed under the Apache License, Version 2.0 (the "License"); 5 # you may not use this file except in compliance with the License. 6 # You may obtain a copy of the License at 7 # 8 # http://www.apache.org/licenses/LICENSE-2.0 9 # 10 # Unless required by applicable law or agreed to in writing, software 11 # distributed under the License is distributed on an "AS IS" BASIS, 12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 # See the License for the specific language governing permissions and 14 # limitations under the License. 15 16 # this script fetches and runs the upstream installer based on BAZEL_VERSION 17 # like 0.14.0 or 0.14.0rc1 etc. 18 set -o errexit 19 set -o nounset 20 21 # match BAZEL_VERSION to installer URL 22 INSTALLER="bazel-${BAZEL_VERSION}-installer-linux-x86_64.sh" 23 if [[ "${BAZEL_VERSION}" =~ ([0-9\.]+)(rc[0-9]+) ]]; then 24 DOWNLOAD_URL="https://storage.googleapis.com/bazel/${BASH_REMATCH[1]}/${BASH_REMATCH[2]}/${INSTALLER}" 25 else 26 DOWNLOAD_URL="https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/${INSTALLER}" 27 fi 28 # get the installer 29 wget -q "${DOWNLOAD_URL}" && chmod +x "${INSTALLER}" 30 # install to user dir 31 "./${INSTALLER}" --user 32 # remove the installer, we no longer need it 33 rm "${INSTALLER}"