forked from operator-framework/operatorhub.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·35 lines (28 loc) · 1.17 KB
/
deploy.sh
File metadata and controls
executable file
·35 lines (28 loc) · 1.17 KB
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
#!/bin/bash
set -e
ENVIRO=$1
if [[ ! "$ENVIRO" =~ ^(pica|dev|preprod|prod)$ ]]; then
echo "Invalid environment $ENVIRO, only dev, preprod and prod supported"
exit
fi
mkdir -p bin
if ! ./bin/oc >/dev/null ; then
echo Installing openshift origin client
wget https://github.com/openshift/origin/releases/download/v3.11.0/openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit.tar.gz
tar -xvf openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit.tar.gz
mv openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit/oc bin/
fi
if ! ./bin/kustomize >/dev/null; then
echo Installing kustomize
wget https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2Fv3.5.4/kustomize_v3.5.4_linux_amd64.tar.gz
tar -xvf kustomize_v3.5.4_linux_amd64.tar.gz
mv kustomize bin
fi
if [[ "$ENVIRO" == "preprod" ]]; then
OPENSHIFT_TOKEN=$OPENSHIFT_TOKEN_PREPROD
fi
./bin/oc login --token="$OPENSHIFT_TOKEN" --server="$OPENSHIFT_SERVER" > /dev/null
./bin/kustomize build k8s/$ENVIRO | sed "s/DEPLOYMENT_RUN_ID/$(uuidgen)/" > manifest.yaml
cat manifest.yaml
cat manifest.yaml | ./bin/oc apply -f -
./bin/oc rollout status -w deploy/operatorhubio