forked from istio/istio
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinit_helm.sh
executable file
·76 lines (63 loc) · 2.39 KB
/
init_helm.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/bash
# Copyright 2018 Istio Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Init script downloads or updates envoy and the go dependencies. Called from Makefile, which sets
# the needed environment variables.
set -o errexit
set -o nounset
set -o pipefail
# TODO(nmittler): Remove these variables and require that this script be run from the Makefile
# Set GOPATH to match the expected layout
GO_TOP=$(cd "$(dirname "$0")"/../../../..; pwd)
export OUT_DIR=${OUT_DIR:-${GO_TOP}/out}
# Current version is 2.9.1, with 2.10RC available
# 2.7.2 was released in Nov 2017.
# 2.10 adds proper support for CRD - we will test with it
# For pre-2.10,
HELM_VER=${HELM_VER:-v2.9.1}
#HELM_VER=${HELM_VER:-v2.10.0-rc.1}
export GOPATH=${GOPATH:-$GO_TOP}
# Normally set by Makefile
export ISTIO_BIN=${ISTIO_BIN:-${GOPATH}/bin}
# Set the architecture. Matches logic in the Makefile.
export GOARCH=${GOARCH:-'amd64'}
# Determine the OS. Matches logic in the Makefile.
LOCAL_OS=${OSTYPE}
case $LOCAL_OS in
"linux"*)
LOCAL_OS='linux'
;;
"darwin"*)
LOCAL_OS='darwin'
;;
*)
echo "This system's OS ${LOCAL_OS} isn't recognized/supported"
exit 1
;;
esac
export GOOS=${GOOS:-${LOCAL_OS}}
# test scripts seem to like to run this script directly rather than use make
export ISTIO_OUT=${ISTIO_OUT:-${ISTIO_BIN}}
# install helm if not present, it must be the local version.
if [ ! -f "${ISTIO_OUT}/version.helm.${HELM_VER}" ] ; then
TD=$(mktemp -d)
# Install helm. Please keep it in sync with .circleci
cd "${TD}" && \
curl -Lo "${TD}/helm.tgz" "https://storage.googleapis.com/kubernetes-helm/helm-${HELM_VER}-${LOCAL_OS}-amd64.tar.gz" && \
tar xfz helm.tgz && \
mv ${LOCAL_OS}-amd64/helm "${ISTIO_OUT}/helm-${HELM_VER}" && \
cp "${ISTIO_OUT}/helm-${HELM_VER}" "${ISTIO_OUT}/helm" && \
rm -rf "${TD}" && \
touch "${ISTIO_OUT}/version.helm.${HELM_VER}"
fi