forked from istio/operator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate_release_charts.sh
executable file
·81 lines (67 loc) · 2.45 KB
/
create_release_charts.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
77
78
79
80
81
#!/usr/bin/env bash
# Copyright 2017 Istio Authors. All Rights Reserved.
#
# 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.
#
################################################################################
set -o errexit
set -o pipefail
TEMP_DIR_DEFAULT="/tmp"
INSTALLER_CHARTS=(base gateways istio-cni istiocoredns istio-telemetry istio-control istio-policy security)
INSTALLER_REPO="installer"
function usage() {
echo "$0
-o <path> path where output/artifacts are stored (required)
-v <ver> version for istio/installer branch (optional)
-d <path> path to use for temp directory (optional, randomized default is under ${TEMP_DIR_DEFAULT} )"
exit 1
}
function die() {
echo "$*" 1>&2 ; exit 1;
}
while getopts o:v:d: arg ; do
case "${arg}" in
o) OUTPUT_DIR="${OPTARG}";;
v) INSTALLER_VERSION="${OPTARG}";;
d) TEMP_DIR="${OPTARG}";;
*) usage;;
esac
done
[[ -z "${OUTPUT_DIR}" ]] && usage
set -x
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
OPERATOR_BASE_DIR="${SCRIPT_DIR}/.."
TEMP_DIR=${TEMP_DIR:-"$(mktemp -d ${TEMP_DIR_DEFAULT}/istio.operator.XXXXXXXX)"}
INSTALLER_SHA=$(cat "${OPERATOR_BASE_DIR}/installer.sha")
INSTALLER_VERSION=${INSTALLER_VERSION:-"${INSTALLER_SHA}"}
mkdir -p "${OUTPUT_DIR}"
function copy_installer_charts() {
cd "${TEMP_DIR}"
git clone https://github.com/istio/${INSTALLER_REPO} || die "Could not clone installer repo"
pushd ${INSTALLER_REPO}
git checkout "${INSTALLER_VERSION}"
popd
local OUTPUT_CHARTS_DIR="${OUTPUT_DIR}/charts"
mkdir -p "${OUTPUT_CHARTS_DIR}"
for chart in "${INSTALLER_CHARTS[@]}"
do
cp -R "${INSTALLER_REPO}/${chart}" "${OUTPUT_CHARTS_DIR}"
done
}
function copy_operator_data() {
cp -R "${OPERATOR_BASE_DIR}/data/profiles" "${OUTPUT_DIR}"
cp -R "${OPERATOR_BASE_DIR}/data/examples" "${OUTPUT_DIR}"
cp "${OPERATOR_BASE_DIR}/version/versions.yaml" "${OUTPUT_DIR}"
}
copy_installer_charts
copy_operator_data