searchlight.sh
Backtick shell command-substitution syntaxContains an unconditional loop header
SHA-2565267d94e34d9710f442ba453f39d583326df32785f9feec576397bfc3962a6b4
MaleculeK(Am)H₆(Cm₁₁CrDb₂F₄Os₆Po₅)Md(Pt)
Evidence
5:25… mission v1alpha1.incidents)
6
7echo "checking kubeconfig context"
8kubectl config current-context || { echo "Set a context (kubectl use-context <context>) out of the following:"; echo; kubectl config get-contexts; exit 1; }
9echo ""
10
11# http://redsymbol.net/articles/bash-exit-traps/
12function cleanup {
13 rm -rf $ONESSL ca.crt ca.key server.crt server.key
14}
15
16export APPSCODE_ENV=${APPSCODE_ENV:-prod}
17if [ "$APPSCODE_ENV" != "test-concourse" ]; then
18 trap cleanup EXIT
19fi
20
21# ref: https://github.com/appscodelabs/libbuild/blob/master/common/lib.sh#L55
22inside_git_repo() {
23 git rev-parse --is-inside-work-tree > /dev/null 2>&1
24 inside_git=$?
25 if [ "$inside_git" -ne 0 ]; then
⋯6 lines
32:19… o
33
34 # http://stackoverflow.com/a/1404862/3476121
35 git_tag=$(git describe --exact-match --abbrev=0 2>/dev/null || echo '')
36
37 commit_hash=$(git rev-parse --verify HEAD)
38 git_branch=$(git rev-parse --abbrev-ref HEAD)
39 commit_timestamp=$(git show -s --format=%ct)
40
41 if [ "$git_tag" != '' ]; then
42 TAG=$git_tag
43 TAG_STRATEGY='git_tag'
44 elif [ "$git_branch" != 'master' ] & …
58:21… mestamp
59}
60
61# https://stackoverflow.com/a/677212/244009
62if [ -x "$(command -v onessl)" ]; then
63 export ONESSL=onessl
64else
65 # ref: https://stackoverflow.com/a/27776822/244009
66 case "$(uname -s)" in
67 Darwin)
68 curl -fsSL -o onessl https://github.com/kubepack/onessl/releases/download/0.3.0/onessl-darwin-amd64
69 chmod +x onessl
70 export ONESSL=./onessl
71 ;;
72
73 Linux)
74 curl -fsSL -o onessl https://github.com/kubepack/onessl/releases/download/0.3.0/onessl-linux-amd64
75 chmod +x onessl
76 export ONESSL=./onessl
77 ;;
78
79 CYGWIN*|MINGW32*|MSYS*)
80 curl -fsSL -o onessl.exe https://github.com/kubepack/onessl/releases/download/0.3.0/onessl-windows-amd64.exe
81 chmod +x onessl.exe
82 export ONESSL=./onessl.exe
83 ;;
⋯7 lines
91:34… ts/2013/05/26/different-ways-to-implement-flags-in-bash/
92# ref: http://tldp.org/LDP/abs/html/comparison-ops.html
93
94export SEARCHLIGHT_NAMESPACE=kube-system
95export SEARCHLIGHT_SERVICE_ACCOUNT=searchlight-operator
96export SEARCHLIGHT_ENABLE_RBAC=true
97export SEARCHLIGHT_RUN_ON_MASTER=0
98export SEARCHLIGHT_ICINGA_API_PASSWORD=
99export SEARCHLIGHT_ENABLE_VALIDATING_WEBHOOK=false
100export SEARCHLIGHT_DOCKER_REGISTRY=${DOCKER_REGISTRY:-appscode}
101export SEARCHLIGHT_OPERATOR_TAG=7.0.0
102export SEARCHLIGHT_ICINGA_TAG=7.0.0-k8s
103export SEARCHLIGHT_IMAGE_PULL_SECRET=
104export SEARCHLIGHT_IMAGE_PULL_POLICY=IfNotPresent
105export SEARCHLIGHT_ENABLE_ANALYTICS=true
106export SEARCHLIGHT_UNINSTALL=0
107export SEARCHLIGHT_PURGE=0
108
109export SCRIPT_LOCATION="curl -fsSL https://raw.githubusercontent.com/appscode/searchlight/7.0.0/"
110if [[ "$APPSCODE_ENV" = "dev" || "$APPSCODE_ENV" = "test-concourse" ]]; then
111 detect_tag
112 export SCRIPT_LOCATION="cat "
142:6… -h|--help)
143 show_help
144 exit 0
145 ;;
146 -n)
147 shift
148 if test $# -gt 0; then
149 export SEARCHLIGHT_NAMESPACE=$1
150 else
151 echo "no na …