forked from wso2-incubator/k8s-on-openstack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
infra.sh
executable file
·57 lines (46 loc) · 1.35 KB
/
infra.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
#!/bin/bash
LOG_FILE_LOCATION="/home/$USER/terraform/ballerina/logs"
# Log Message should be parsed $1
log(){
TIME=`date`
#echo "$TIME : $1" >> "$LOG_FILE_LOCATION"
echo "$TIME : $1"
return
}
prgdir=$(dirname "$0")
script_path=$(cd "$prgdir"; pwd)
log "===The Jenkins Main Script Logs===="
log "Checking the Environment variables;"
if [ -z $OS_TENANT_ID ]; then
log "OS_TENANT_ID is not set as a environment variable"
exit 1;
fi
if [ -z $OS_TENANT_NAME ]; then
log "OS_TENANT_ID is not set as a environment variable"
exit 1;
fi
if [ -z $OS_USERNAME ]; then
log "OS_TENANT_ID is not set as a environment variable"
exit 1;
fi
if [ -z $OS_PASSWORD ]; then
log "OS_TENANT_ID is not set as a environment variable"
exit 1;
fi
# Seems Jenkins is not picking the Path variables from the system, hence as a workaroubd setting the path
TERRA_HOME=/etc/terraform
export PATH=$TERRA_HOME:$PATH
# Trigering the Ansible Scripts to do the kubernetes cluster
source $script_path/cluster-create.sh
# Check the cluster health
#if [ -z $KUBERNETES_MASTER ]; then
# log "KUBERNETES_MASTER is not set as a environment variable"
# exit 1;
#fi
#STRING_TO_TEST="k8s-master Ready"
#OUTPUT=$(kubectl get nodes)
#if [[ $OUTPUT != *"${STRING_TO_TEST}"* ]]; then
# log "Seems Kubenetes cluster is not setup properly, Hence Exiting"
# exit 1;
#fi
log "Successfully Finished Execution..."