-
Notifications
You must be signed in to change notification settings - Fork 3
/
local.sh
68 lines (55 loc) · 1.62 KB
/
local.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
#!/bin/bash
##################
# Script: local.sh
# Main entrypoint for DotCMS local execution.
# Usually called from devs local machine.
# Prints script usage
function usage {
echo "Usage: <operation>
Required arguments:
- operation: operation to run (e.g. 'runCurl', 'runIntegration' OR 'runUnit')
"
}
: ${DOT_CICD_TARGET:="core"} && export DOT_CICD_TARGET
export CICD_LOCAL_FOLDER="${DOT_CICD_LIB}/local/${DOT_CICD_TARGET}"
export operation=$0
if [[ -z "${operation}" ]]; then
echo 'Operation argument was not provided, aborting...'
usage
exit 1
fi
localScript=${CICD_LOCAL_FOLDER}/${operation}.sh
if [[ ! -s ${localScript} ]]; then
echo 'Local script associated to operation cannot be found, aborting...'
exit 1
fi
export DOT_CICD_STAGE_OPERATION=${DOT_CICD_STAGE_FOLDER}/${operation}
mkdir -p ${DOT_CICD_STAGE_OPERATION}
: ${DOT_CICD_DOCKER_PATH:="${DOT_CICD_PATH}/docker"} && export DOT_CICD_DOCKER_PATH
: ${DOCKER_SOURCE:="${DOT_CICD_LIB}/docker"} && export DOCKER_SOURCE
: ${DEBUG_MODE:="false"} && export DEBUG_MODE
. ${DOT_CICD_LIB}/pipeline/github/githubCommon.sh
echo "
###################
Local dot-cicd vars
###################
DOT_CICD_TARGET: ${DOT_CICD_TARGET}
DOT_CICD_STAGE_FOLDER: ${DOT_CICD_STAGE_FOLDER}
DOT_CICD_STAGE_OPERATION: ${DOT_CICD_STAGE_OPERATION}
DOT_CICD_DOCKER_PATH: ${DOT_CICD_DOCKER_PATH}
DOCKER_SOURCE: ${DOCKER_SOURCE}
DEBUG_MODE: ${DEBUG_MODE}
"
echo "############
Java version
############"
java -version
echo
echo "#################
Script Arguments
#################
operation: ${operation}
Working folder: ${DOT_CICD_STAGE_OPERATION}
"
echo "Executing: ${localScript}"
. ${localScript}