-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathentrypoint.sh
executable file
·57 lines (47 loc) · 1.35 KB
/
entrypoint.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
#!/bin/sh
###################################################################
# Command: #
# run -e PLAYGROUND_PAT=... "appName" "environment" "configFile" #
###################################################################
# get args
debug=$1
appName=$2
environment=$3
configFile=$4
## appName cannot be empty
if [[ -z "$appName" ]]; then
echo "appName can not be empty"
exit 1
fi
# if there is a configFile...
if [[ -n "$configFile" ]]; then
echo "using custom installation from $configFile "
mkdir -p /napptive
cp ${configFile} /napptive/.playground.yaml
if [[ $? -ne 0 ]]; then
exit 1
fi
export PLAYGROUND_CONFIG=/napptive/
echo "PLAYGROUND_CONFIG env added: $PLAYGROUND_CONFIG"
fi
# add actual dir to the path to allow execute the playground command
export PATH=$PATH:/app/
# Step 1. Login in to the platform
# Login into the platform (with pat flag)
/app/playground login --pat --debug=$debug
if [[ $? -ne 0 ]]; then
exit 1
fi
# if environment!= "" -> use it!
if [[ -n "$environment" ]]; then
/app/playground env use ${environment} --debug=$debug
if [[ $? -ne 0 ]]; then
exit 1
fi
fi
echo "deploying ${appName}..."
# deploy the app
/app/playground catalog deploy ${appName} --debug=$debug
if [[ $? -ne 0 ]]; then
exit 1
fi