Michael Lando | 451a340 | 2017-02-19 10:28:42 +0200 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 3 | # |
| 4 | # Constants: |
| 5 | # |
| 6 | |
| 7 | WORKSPACE="${WORKSPACE:-}" |
| 8 | SUCCESS=0 |
| 9 | FAILURE=1 |
| 10 | |
Yuli Shlosberg | 0875ce0 | 2018-01-25 13:53:36 +0200 | [diff] [blame] | 11 | CS_PASSWORD="onap123#@!" |
| 12 | SDC_USER="asdc_user" |
| 13 | SDC_PASSWORD="Aa1234%^!" |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 14 | |
Yuli Shlosberg | 958c32d | 2018-02-15 12:04:46 +0200 | [diff] [blame] | 15 | JETTY_BASE="/var/lib/jetty" |
kooper | b087a8b | 2019-04-04 14:03:36 +0000 | [diff] [blame] | 16 | SDC_CERT_DIR="onap/cert" |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 17 | |
| 18 | RELEASE=latest |
kaihlavi | 900985e | 2019-06-06 14:52:02 +0300 | [diff] [blame] | 19 | |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 20 | LOCAL=false |
Tal Gitelman | ef4b94e | 2018-08-02 17:11:25 +0300 | [diff] [blame] | 21 | BE_DEBUG_PORT="--publish 4000:4000" |
| 22 | FE_DEBUG_PORT="--publish 6000:6000" |
Tal Gitelman | c4d387d | 2019-03-28 11:00:54 +0200 | [diff] [blame] | 23 | ONBOARD_DEBUG_PORT="--publish 4001:4001" |
shrek2000 | 0594c41 | 2020-01-30 14:52:49 +0200 | [diff] [blame] | 24 | CS_PORT=${CS_PORT:-9042} |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 25 | |
k.kedron | cb30f3a | 2020-03-05 13:12:27 +0100 | [diff] [blame] | 26 | OS_USER="onap" |
| 27 | |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 28 | |
| 29 | # Java Options: |
Gitelman, Tal (tg851x) | 328388b | 2018-03-22 13:03:44 +0200 | [diff] [blame] | 30 | BE_JAVA_OPTIONS="-Xdebug -agentlib:jdwp=transport=dt_socket,address=4000,server=y,suspend=n -Xmx1536m -Xms1536m" |
| 31 | FE_JAVA_OPTIONS="-Xdebug -agentlib:jdwp=transport=dt_socket,address=6000,server=y,suspend=n -Xmx256m -Xms256m" |
Avi Ziv | c175a0d | 2018-03-15 13:21:44 +0200 | [diff] [blame] | 32 | ONBOARD_BE_JAVA_OPTIONS="-Xdebug -agentlib:jdwp=transport=dt_socket,address=4001,server=y,suspend=n -Xmx1g -Xms1g" |
amohamad | 9ee6094 | 2020-06-26 12:40:11 -0400 | [diff] [blame] | 33 | SIM_JAVA_OPTIONS=" -Xmx128m -Xms128m -Xss1m -Dlog4j.configuration=file:///${JETTY_BASE}/config/sdc-simulator/log4j2.properties" |
Yuli Shlosberg | f59a225 | 2018-03-21 11:14:08 +0200 | [diff] [blame] | 34 | API_TESTS_JAVA_OPTIONS="-Xmx512m -Xms512m" |
| 35 | UI_TESTS_JAVA_OPTIONS="-Xmx1024m -Xms1024m" |
dekstroza | 8352006 | 2018-05-03 16:47:08 +0100 | [diff] [blame] | 36 | #Define this as variable, so it can be excluded in run commands on Docker for OSX, as /etc/localtime cant be mounted there. |
| 37 | LOCAL_TIME_MOUNT_CMD="--volume /etc/localtime:/etc/localtime:ro" |
| 38 | # If os is OSX, unset this, so /etc/localtime is not mounted, otherwise leave it be |
| 39 | if [[ "$OSTYPE" == "darwin"* ]]; then |
| 40 | LOCAL_TIME_MOUNT_CMD="" |
| 41 | fi |
| 42 | |
| 43 | |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 44 | # |
| 45 | # Functions: |
| 46 | # |
| 47 | |
Michael Lando | 451a340 | 2017-02-19 10:28:42 +0200 | [diff] [blame] | 48 | |
Grinberg Moti | c3bda48 | 2017-02-23 11:24:34 +0200 | [diff] [blame] | 49 | function usage { |
kaihlavi | 900985e | 2019-06-06 14:52:02 +0300 | [diff] [blame] | 50 | echo "usage: docker_run.sh [ -r|--release <RELEASE-NAME> ] [ -e|--environment <ENV-NAME> ] [ -p|--port <Docker-hub-port>] [ -l|--local <Run-without-pull>] [ -sim|--simulator <Run-with-simulator>] [ -ta <run api tests with the supplied test suit>] [ -tu <run ui tests with the supplied test suit>] [ -ta <run api tests with the supplied test suit>] [ -tu <run ui tests with the supplied test suit>] [ -tad <run api tests with the default test suit>] [ -tu <run ui tests with the default test suit>] [ -h|--help ]" |
Michael Lando | dc856bb | 2018-08-13 13:27:52 +0300 | [diff] [blame] | 51 | echo "start dockers built locally example: docker_run.sh -l" |
| 52 | echo "start dockers built locally and simulator example: docker_run.sh -l -sim" |
kaihlavi | b237271 | 2019-05-27 16:28:23 +0300 | [diff] [blame] | 53 | echo "start dockers, pull from onap nexus according to release and simulator example: docker_run.sh -r 1.5-STAGING-latest -sim" |
Michael Lando | dc856bb | 2018-08-13 13:27:52 +0300 | [diff] [blame] | 54 | echo "start dockers built locally and run api tests docker example: docker_run.sh -l -tad" |
| 55 | echo "start dockers built locally and run only the catalog be example: docker_run.sh -l -d sdc-BE " |
Michael Lando | 451a340 | 2017-02-19 10:28:42 +0200 | [diff] [blame] | 56 | } |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 57 | # |
Michael Lando | 451a340 | 2017-02-19 10:28:42 +0200 | [diff] [blame] | 58 | |
| 59 | |
Grinberg Moti | c3bda48 | 2017-02-23 11:24:34 +0200 | [diff] [blame] | 60 | function cleanup { |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 61 | echo "Performing old dockers cleanup" |
Yuli Shlosberg | 958c32d | 2018-02-15 12:04:46 +0200 | [diff] [blame] | 62 | |
| 63 | if [ "$1" == "all" ] ; then |
k.kedron | 3643cc5 | 2019-08-28 15:01:51 +0200 | [diff] [blame] | 64 | docker_ids=`docker ps -a | egrep "ecomp-nexus:${PORT}/sdc|sdc|Exit}|dcae" | awk '{print $1}'` |
Yuli Shlosberg | 958c32d | 2018-02-15 12:04:46 +0200 | [diff] [blame] | 65 | for X in ${docker_ids} |
| 66 | do |
| 67 | docker rm -f ${X} |
| 68 | done |
| 69 | else |
| 70 | echo "performing $1 docker cleanup" |
| 71 | tmp=`docker ps -a -q --filter="name=$1"` |
Yuli Shlosberg | 474996a | 2018-02-27 18:55:25 +0200 | [diff] [blame] | 72 | if [[ ! -z "$tmp" ]]; then |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 73 | docker rm -f ${tmp} |
| 74 | fi |
Yuli Shlosberg | 958c32d | 2018-02-15 12:04:46 +0200 | [diff] [blame] | 75 | fi |
Grinberg Moti | c3bda48 | 2017-02-23 11:24:34 +0200 | [diff] [blame] | 76 | } |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 77 | # |
Grinberg Moti | c3bda48 | 2017-02-23 11:24:34 +0200 | [diff] [blame] | 78 | |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 79 | |
Grinberg Moti | c3bda48 | 2017-02-23 11:24:34 +0200 | [diff] [blame] | 80 | function dir_perms { |
Michael Lando | 4b9b947 | 2018-06-02 19:14:05 +0300 | [diff] [blame] | 81 | mkdir -p ${WORKSPACE}/data/logs/BE/SDC/SDC-BE |
| 82 | mkdir -p ${WORKSPACE}/data/logs/FE/SDC/SDC-FE |
| 83 | mkdir -p ${WORKSPACE}/data/logs/sdc-api-tests/ExtentReport |
| 84 | mkdir -p ${WORKSPACE}/data/logs/ONBOARD/SDC/ONBOARD-BE |
kaihlavi | 900985e | 2019-06-06 14:52:02 +0300 | [diff] [blame] | 85 | mkdir -p ${WORKSPACE}/data/logs/sdc-api-tests/target |
| 86 | mkdir -p ${WORKSPACE}/data/logs/sdc-ui-tests/ExtentReport |
| 87 | mkdir -p ${WORKSPACE}/data/logs/sdc-ui-tests/target |
| 88 | mkdir -p ${WORKSPACE}/data/logs/docker_logs |
| 89 | mkdir -p ${WORKSPACE}/data/logs/WS |
andre.schmid | fa1db43 | 2019-10-29 17:18:22 +0000 | [diff] [blame] | 90 | echo "Creating dir '${WORKSPACE}/data/${SDC_CERT_DIR}'" |
kaihlavi | 900985e | 2019-06-06 14:52:02 +0300 | [diff] [blame] | 91 | mkdir -p ${WORKSPACE}/data/${SDC_CERT_DIR} |
Michael Lando | 4b9b947 | 2018-06-02 19:14:05 +0300 | [diff] [blame] | 92 | chmod -R 777 ${WORKSPACE}/data/logs |
Grinberg Moti | c3bda48 | 2017-02-23 11:24:34 +0200 | [diff] [blame] | 93 | } |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 94 | # |
| 95 | |
Yuli Shlosberg | 36604c7 | 2018-02-25 16:03:45 +0200 | [diff] [blame] | 96 | |
Yuli Shlosberg | b4deec1 | 2018-02-25 20:24:44 +0200 | [diff] [blame] | 97 | function docker_logs { |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 98 | docker logs $1 > ${WORKSPACE}/data/logs/docker_logs/$1_docker.log |
Yuli Shlosberg | b4deec1 | 2018-02-25 20:24:44 +0200 | [diff] [blame] | 99 | } |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 100 | # |
Yuli Shlosberg | b4deec1 | 2018-02-25 20:24:44 +0200 | [diff] [blame] | 101 | |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 102 | |
| 103 | # |
| 104 | # Readiness Prob |
| 105 | # |
| 106 | |
| 107 | function ready_probe { |
Michael Lando | 4b9b947 | 2018-06-02 19:14:05 +0300 | [diff] [blame] | 108 | docker exec $1 /var/lib/ready-probe.sh > /dev/null 2>&1 |
| 109 | rc=$? |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 110 | if [[ ${rc} == 0 ]]; then |
| 111 | echo DOCKER $1 start finished in $2 seconds |
| 112 | return ${SUCCESS} |
Michael Lando | 4b9b947 | 2018-06-02 19:14:05 +0300 | [diff] [blame] | 113 | fi |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 114 | return ${FAILURE} |
Yuli Shlosberg | 0875ce0 | 2018-01-25 13:53:36 +0200 | [diff] [blame] | 115 | } |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 116 | # |
Yuli Shlosberg | 0875ce0 | 2018-01-25 13:53:36 +0200 | [diff] [blame] | 117 | |
MichaelMorris | a2abf6e | 2020-03-10 12:37:48 +0000 | [diff] [blame] | 118 | function ready_probe_jetty { |
| 119 | docker exec $1 /var/lib/jetty/ready-probe.sh > /dev/null 2>&1 |
| 120 | rc=$? |
| 121 | if [[ ${rc} == 0 ]]; then |
| 122 | echo DOCKER $1 start finished in $2 seconds |
| 123 | return ${SUCCESS} |
| 124 | fi |
| 125 | return ${FAILURE} |
| 126 | } |
| 127 | # |
Yuli Shlosberg | 958c32d | 2018-02-15 12:04:46 +0200 | [diff] [blame] | 128 | |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 129 | function probe_docker { |
| 130 | MATCH=`docker logs --tail 30 $1 | grep "DOCKER STARTED"` |
| 131 | echo MATCH is -- ${MATCH} |
Avi Ziv | c175a0d | 2018-03-15 13:21:44 +0200 | [diff] [blame] | 132 | |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 133 | if [ -n "$MATCH" ] ; then |
| 134 | echo DOCKER start finished in $2 seconds |
| 135 | return ${SUCCESS} |
Michael Lando | 4b9b947 | 2018-06-02 19:14:05 +0300 | [diff] [blame] | 136 | fi |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 137 | return ${FAILURE} |
Yuli Shlosberg | 958c32d | 2018-02-15 12:04:46 +0200 | [diff] [blame] | 138 | } |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 139 | # |
| 140 | |
kaihlavi | 02f4880 | 2019-07-30 19:23:52 +0300 | [diff] [blame] | 141 | function probe_test_docker { |
| 142 | # This expected logging should be output by startup.sh of the |
| 143 | # respective test docker container |
| 144 | MATCH=`docker logs --tail 30 $1 | grep "Startup completed successfully"` |
| 145 | echo MATCH is -- ${MATCH} |
| 146 | |
| 147 | if [ -n "$MATCH" ] ; then |
| 148 | echo TEST DOCKER start finished in $2 seconds |
| 149 | return ${SUCCESS} |
| 150 | fi |
| 151 | return ${FAILURE} |
| 152 | } |
| 153 | # |
| 154 | |
Yuli Shlosberg | 958c32d | 2018-02-15 12:04:46 +0200 | [diff] [blame] | 155 | |
Yuli Shlosberg | f59a225 | 2018-03-21 11:14:08 +0200 | [diff] [blame] | 156 | function probe_sim { |
Michael Lando | 4b9b947 | 2018-06-02 19:14:05 +0300 | [diff] [blame] | 157 | if lsof -Pi :8285 -sTCP:LISTEN -t >/dev/null ; then |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 158 | echo "Already running" |
| 159 | return ${SUCCESS} |
Michael Lando | 4b9b947 | 2018-06-02 19:14:05 +0300 | [diff] [blame] | 160 | else |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 161 | echo "Not running" |
| 162 | return ${FAILURE} |
Michael Lando | 4b9b947 | 2018-06-02 19:14:05 +0300 | [diff] [blame] | 163 | fi |
Yuli Shlosberg | f59a225 | 2018-03-21 11:14:08 +0200 | [diff] [blame] | 164 | } |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 165 | # |
Yuli Shlosberg | f59a225 | 2018-03-21 11:14:08 +0200 | [diff] [blame] | 166 | |
Yuli Shlosberg | 0875ce0 | 2018-01-25 13:53:36 +0200 | [diff] [blame] | 167 | |
Yuli Shlosberg | 5571a86 | 2017-10-03 18:18:51 +0300 | [diff] [blame] | 168 | function monitor_docker { |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 169 | DOCKER_NAME=$1 |
| 170 | echo "Monitor ${DOCKER_NAME} Docker" |
Idan Amit | db3d554 | 2017-12-07 11:33:32 +0200 | [diff] [blame] | 171 | sleep 5 |
| 172 | TIME_OUT=900 |
| 173 | INTERVAL=20 |
| 174 | TIME=0 |
Avi Ziv | c175a0d | 2018-03-15 13:21:44 +0200 | [diff] [blame] | 175 | |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 176 | while [ "$TIME" -lt "$TIME_OUT" ]; do |
| 177 | |
| 178 | case ${DOCKER_NAME} in |
| 179 | |
| 180 | sdc-cs) |
| 181 | ready_probe ${DOCKER_NAME} ${TIME} ; |
| 182 | status=$? ; |
| 183 | ;; |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 184 | sdc-BE) |
MichaelMorris | a2abf6e | 2020-03-10 12:37:48 +0000 | [diff] [blame] | 185 | ready_probe_jetty ${DOCKER_NAME} ${TIME} ; |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 186 | status=$? ; |
| 187 | ;; |
| 188 | sdc-FE) |
MichaelMorris | a2abf6e | 2020-03-10 12:37:48 +0000 | [diff] [blame] | 189 | ready_probe_jetty ${DOCKER_NAME} ${TIME} ; |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 190 | status=$? ; |
| 191 | ;; |
| 192 | sdc-onboard-BE) |
MichaelMorris | a2abf6e | 2020-03-10 12:37:48 +0000 | [diff] [blame] | 193 | ready_probe_jetty ${DOCKER_NAME} ${TIME} ; |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 194 | status=$? ; |
| 195 | ;; |
kaihlavi | 02f4880 | 2019-07-30 19:23:52 +0300 | [diff] [blame] | 196 | sdc-api-tests) |
| 197 | probe_test_docker ${DOCKER_NAME} ${TIME}; |
| 198 | status=$? ; |
| 199 | ;; |
| 200 | sdc-ui-tests) |
| 201 | probe_test_docker ${DOCKER_NAME} ${TIME}; |
| 202 | status=$? ; |
| 203 | ;; |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 204 | *) |
| 205 | probe_docker ${DOCKER_NAME} ${TIME}; |
| 206 | status=$? ; |
| 207 | ;; |
| 208 | |
| 209 | esac |
| 210 | |
k.kedron | 3643cc5 | 2019-08-28 15:01:51 +0200 | [diff] [blame] | 211 | if [[ ${status} == ${SUCCESS} ]] ; then |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 212 | break; |
Idan Amit | db3d554 | 2017-12-07 11:33:32 +0200 | [diff] [blame] | 213 | fi |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 214 | |
| 215 | echo "Sleep: ${INTERVAL} seconds before testing if ${DOCKER_NAME} DOCKER is up. Total wait time up now is: ${TIME} seconds. Timeout is: ${TIME_OUT} seconds" |
| 216 | sleep ${INTERVAL} |
Idan Amit | db3d554 | 2017-12-07 11:33:32 +0200 | [diff] [blame] | 217 | TIME=$(($TIME+$INTERVAL)) |
| 218 | done |
Yuli Shlosberg | 5571a86 | 2017-10-03 18:18:51 +0300 | [diff] [blame] | 219 | |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 220 | docker_logs ${DOCKER_NAME} |
Yuli Shlosberg | 36604c7 | 2018-02-25 16:03:45 +0200 | [diff] [blame] | 221 | |
Idan Amit | db3d554 | 2017-12-07 11:33:32 +0200 | [diff] [blame] | 222 | if [ "$TIME" -ge "$TIME_OUT" ]; then |
| 223 | echo -e "\e[1;31mTIME OUT: DOCKER was NOT fully started in $TIME_OUT seconds... Could cause problems ...\e[0m" |
| 224 | fi |
Yuli Shlosberg | 5571a86 | 2017-10-03 18:18:51 +0300 | [diff] [blame] | 225 | } |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 226 | # |
| 227 | |
k.kedron | 3643cc5 | 2019-08-28 15:01:51 +0200 | [diff] [blame] | 228 | # healthCheck script used the secure connection to send request (https is always turn on) |
Yuli Shlosberg | d1bb2e5 | 2018-01-15 11:51:21 +0200 | [diff] [blame] | 229 | function healthCheck { |
Yuli Shlosberg | d1bb2e5 | 2018-01-15 11:51:21 +0200 | [diff] [blame] | 230 | |
kaihlavi | 900985e | 2019-06-06 14:52:02 +0300 | [diff] [blame] | 231 | echo "BE Health Check:" |
k.kedron | 3643cc5 | 2019-08-28 15:01:51 +0200 | [diff] [blame] | 232 | curl -k --noproxy "*" https://${IP}:8443/sdc2/rest/healthCheck |
Yuli Shlosberg | d1bb2e5 | 2018-01-15 11:51:21 +0200 | [diff] [blame] | 233 | |
| 234 | echo "" |
| 235 | echo "" |
kaihlavi | 900985e | 2019-06-06 14:52:02 +0300 | [diff] [blame] | 236 | echo "FE Health Check:" |
k.kedron | 3643cc5 | 2019-08-28 15:01:51 +0200 | [diff] [blame] | 237 | curl -k --noproxy "*" https://${IP}:9443/sdc1/rest/healthCheck |
Yuli Shlosberg | d1bb2e5 | 2018-01-15 11:51:21 +0200 | [diff] [blame] | 238 | |
| 239 | |
| 240 | echo "" |
| 241 | echo "" |
k.kedron | 3643cc5 | 2019-08-28 15:01:51 +0200 | [diff] [blame] | 242 | healthCheck_http_code=$(curl -k --noproxy "*" -o /dev/null -w '%{http_code}' -H "Accept: application/json" -H "Content-Type: application/json" -H "USER_ID: jh0003" https://${IP}:8443/sdc2/rest/v1/user/demo;) |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 243 | if [[ ${healthCheck_http_code} != 200 ]]; then |
kaihlavi | 900985e | 2019-06-06 14:52:02 +0300 | [diff] [blame] | 244 | echo "Error [${healthCheck_http_code}] while checking existence of user" |
Yuli Shlosberg | d1bb2e5 | 2018-01-15 11:51:21 +0200 | [diff] [blame] | 245 | return ${healthCheck_http_code} |
| 246 | fi |
kaihlavi | 900985e | 2019-06-06 14:52:02 +0300 | [diff] [blame] | 247 | echo "check user existence: OK" |
Yuli Shlosberg | d1bb2e5 | 2018-01-15 11:51:21 +0200 | [diff] [blame] | 248 | return ${healthCheck_http_code} |
| 249 | } |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 250 | # |
Yuli Shlosberg | d1bb2e5 | 2018-01-15 11:51:21 +0200 | [diff] [blame] | 251 | |
Tal Gitelman | e224d0b | 2017-10-17 15:24:25 +0300 | [diff] [blame] | 252 | |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 253 | function command_exit_status { |
| 254 | status=$1 |
| 255 | docker=$2 |
| 256 | if [ "${status}" != "0" ] ; then |
| 257 | echo "[ ERROR ] Docker ${docker} run command exit with status [${status}]" |
| 258 | fi |
| 259 | } |
| 260 | # |
| 261 | |
| 262 | |
| 263 | # |
| 264 | # Run Containers |
| 265 | # |
| 266 | |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 267 | |
| 268 | #Cassandra |
| 269 | function sdc-cs { |
| 270 | DOCKER_NAME="sdc-cs" |
| 271 | echo "docker run sdc-cassandra..." |
| 272 | if [ ${LOCAL} = false ]; then |
| 273 | docker pull ${PREFIX}/sdc-cassandra:${RELEASE} |
| 274 | fi |
shrek2000 | 0594c41 | 2020-01-30 14:52:49 +0200 | [diff] [blame] | 275 | docker run -dit --name ${DOCKER_NAME} --env RELEASE="${RELEASE}" --env CS_PASSWORD="${CS_PASSWORD}" --env ENVNAME="${DEP_ENV}" --env HOST_IP=${IP} --env MAX_HEAP_SIZE="1536M" --env HEAP_NEWSIZE="512M" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 ${LOCAL_TIME_MOUNT_CMD} --volume ${WORKSPACE}/data/CS:/var/lib/cassandra --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments --publish ${CS_PORT}:${CS_PORT} ${PREFIX}/sdc-cassandra:${RELEASE} /bin/sh |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 276 | command_exit_status $? ${DOCKER_NAME} |
| 277 | echo "please wait while CS is starting..." |
| 278 | monitor_docker ${DOCKER_NAME} |
| 279 | } |
| 280 | # |
| 281 | |
| 282 | |
| 283 | #Cassandra-init |
| 284 | function sdc-cs-init { |
| 285 | DOCKER_NAME="sdc-cs-init" |
| 286 | echo "docker run sdc-cassandra-init..." |
| 287 | if [ ${LOCAL} = false ]; then |
| 288 | docker pull ${PREFIX}/sdc-cassandra-init:${RELEASE} |
| 289 | fi |
MichaelMorris | a2abf6e | 2020-03-10 12:37:48 +0000 | [diff] [blame] | 290 | docker run --name ${DOCKER_NAME} --env RELEASE="${RELEASE}" --env SDC_USER="${SDC_USER}" --env SDC_PASSWORD="${SDC_PASSWORD}" --env CS_PASSWORD="${CS_PASSWORD}" --env ENVNAME="${DEP_ENV}" --env HOST_IP=${IP} --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 ${LOCAL_TIME_MOUNT_CMD} --volume ${WORKSPACE}/data/CS:/var/lib/cassandra --volume ${WORKSPACE}/data/environments:/home/sdc/chef-solo/environments --volume ${WORKSPACE}/data/CS-Init:/root/chef-solo/cache ${PREFIX}/sdc-cassandra-init:${RELEASE} > /dev/null 2>&1 |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 291 | rc=$? |
| 292 | docker_logs ${DOCKER_NAME} |
| 293 | if [[ ${rc} != 0 ]]; then exit ${rc}; fi |
| 294 | } |
| 295 | # |
| 296 | |
| 297 | |
| 298 | #Onboard Cassandra-init |
| 299 | function sdc-cs-onboard-init { |
| 300 | DOCKER_NAME="sdc-cs-onboard-init" |
| 301 | echo "docker run sdc-cs-onboard-init..." |
| 302 | if [ ${LOCAL} = false ]; then |
| 303 | docker pull ${PREFIX}/sdc-onboard-cassandra-init:${RELEASE} |
| 304 | fi |
MichaelMorris | a2abf6e | 2020-03-10 12:37:48 +0000 | [diff] [blame] | 305 | docker run --name ${DOCKER_NAME} --env RELEASE="${RELEASE}" --env CS_HOST_IP=${IP} --env CS_HOST_PORT=${CS_PORT} --env SDC_USER="${SDC_USER}" --env SDC_PASSWORD="${SDC_PASSWORD}" --env CS_PASSWORD="${CS_PASSWORD}" --env ENVNAME="${DEP_ENV}" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 ${LOCAL_TIME_MOUNT_CMD} --volume ${WORKSPACE}/data/CS:/var/lib/cassandra --volume ${WORKSPACE}/data/environments:/home/sdc/chef-solo/environments --volume ${WORKSPACE}/data/CS-Init:/home/sdc/chef-solo/cache ${PREFIX}/sdc-onboard-cassandra-init:${RELEASE} |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 306 | rc=$? |
| 307 | docker_logs ${DOCKER_NAME} |
| 308 | if [[ ${rc} != 0 ]]; then exit ${rc}; fi |
| 309 | } |
| 310 | # |
| 311 | |
| 312 | |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 313 | #Back-End |
| 314 | function sdc-BE { |
| 315 | DOCKER_NAME="sdc-BE" |
| 316 | echo "docker run sdc-backend..." |
| 317 | if [ ${LOCAL} = false ]; then |
| 318 | docker pull ${PREFIX}/sdc-backend:${RELEASE} |
| 319 | else |
Tal Gitelman | ef4b94e | 2018-08-02 17:11:25 +0300 | [diff] [blame] | 320 | ADDITIONAL_ARGUMENTS=${BE_DEBUG_PORT} |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 321 | fi |
MichaelMorris | a2abf6e | 2020-03-10 12:37:48 +0000 | [diff] [blame] | 322 | docker run --detach --name ${DOCKER_NAME} --env HOST_IP=${IP} --env ENVNAME="${DEP_ENV}" --env cassandra_ssl_enabled="false" --env JAVA_OPTIONS="${BE_JAVA_OPTIONS}" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 ${LOCAL_TIME_MOUNT_CMD} --volume ${WORKSPACE}/data/logs/BE/:${JETTY_BASE}/logs --volume ${WORKSPACE}/data/environments:${JETTY_BASE}/chef-solo/environments --publish 8443:8443 --publish 8080:8080 ${ADDITIONAL_ARGUMENTS} ${PREFIX}/sdc-backend:${RELEASE} |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 323 | command_exit_status $? ${DOCKER_NAME} |
| 324 | echo "please wait while BE is starting..." |
| 325 | monitor_docker ${DOCKER_NAME} |
| 326 | } |
| 327 | # |
| 328 | |
| 329 | |
| 330 | # Back-End-Init |
| 331 | function sdc-BE-init { |
| 332 | DOCKER_NAME="sdc-BE-init" |
| 333 | echo "docker run sdc-backend-init..." |
| 334 | if [ ${LOCAL} = false ]; then |
| 335 | docker pull ${PREFIX}/sdc-backend-init:${RELEASE} |
| 336 | fi |
k.kedron | cb30f3a | 2020-03-05 13:12:27 +0100 | [diff] [blame] | 337 | docker run --name ${DOCKER_NAME} --env HOST_IP=${IP} --env ENVNAME="${DEP_ENV}" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 ${LOCAL_TIME_MOUNT_CMD} --volume ${WORKSPACE}/data/logs/BE/:${JETTY_BASE}/logs --volume ${WORKSPACE}/data/environments:/home/${OS_USER}/chef-solo/environments ${PREFIX}/sdc-backend-init:${RELEASE} > /dev/null 2>&1 |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 338 | rc=$? |
| 339 | docker_logs ${DOCKER_NAME} |
| 340 | if [[ ${rc} != 0 ]]; then exit ${rc}; fi |
| 341 | } |
| 342 | # |
| 343 | |
| 344 | |
| 345 | # Onboard Back-End |
| 346 | function sdc-onboard-BE { |
| 347 | DOCKER_NAME="sdc-onboard-BE" |
| 348 | echo "docker run sdc-onboard-BE ..." |
| 349 | # TODO Check the dir_perms action . do we need it here ?? |
| 350 | # dir_perms |
| 351 | if [ ${LOCAL} = false ]; then |
| 352 | docker pull ${PREFIX}/sdc-onboard-backend:${RELEASE} |
| 353 | else |
| 354 | ADDITIONAL_ARGUMENTS=${ONBOARD_DEBUG_PORT} |
| 355 | fi |
MichaelMorris | a2abf6e | 2020-03-10 12:37:48 +0000 | [diff] [blame] | 356 | docker run --detach --name ${DOCKER_NAME} --env HOST_IP=${IP} --env ENVNAME="${DEP_ENV}" --env cassandra_ssl_enabled="false" --env SDC_CLUSTER_NAME="SDC-CS-${DEP_ENV}" --env SDC_USER="${SDC_USER}" --env SDC_PASSWORD="${SDC_PASSWORD}" --env SDC_CERT_DIR="${SDC_CERT_DIR}" --env JAVA_OPTIONS="${ONBOARD_BE_JAVA_OPTIONS}" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 ${LOCAL_TIME_MOUNT_CMD} --volume ${WORKSPACE}/data/${SDC_CERT_DIR}:${JETTY_BASE}/onap/cert --volume ${WORKSPACE}/data/logs/ONBOARD:${JETTY_BASE}/logs --volume ${WORKSPACE}/data/environments:/${JETTY_BASE}/chef-solo/environments --publish 8445:8445 --publish 8081:8081 ${ADDITIONAL_ARGUMENTS} ${PREFIX}/sdc-onboard-backend:${RELEASE} |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 357 | command_exit_status $? ${DOCKER_NAME} |
| 358 | echo "please wait while sdc-onboard-BE is starting..." |
| 359 | monitor_docker ${DOCKER_NAME} |
| 360 | } |
| 361 | # |
| 362 | |
| 363 | |
| 364 | # Front-End |
| 365 | function sdc-FE { |
| 366 | DOCKER_NAME="sdc-FE" |
Dmitry Puzikov | 0574f88 | 2020-03-05 18:03:15 +0100 | [diff] [blame] | 367 | IMAGE_NAME="${PREFIX}/sdc-frontend:${RELEASE}" |
| 368 | echo "Running container '${DOCKER_NAME}' based on '${IMAGE_NAME}' image..." |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 369 | if [ ${LOCAL} = false ]; then |
| 370 | docker pull ${PREFIX}/sdc-frontend:${RELEASE} |
Tal Gitelman | ef4b94e | 2018-08-02 17:11:25 +0300 | [diff] [blame] | 371 | else |
| 372 | ADDITIONAL_ARGUMENTS=${FE_DEBUG_PORT} |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 373 | fi |
Dmitry Puzikov | 0574f88 | 2020-03-05 18:03:15 +0100 | [diff] [blame] | 374 | |
| 375 | PLUGIN_CONFIG_FILE="${WORKSPACE}/data/environments/plugins-configuration.yaml" |
| 376 | if [[ -f ${WORKSPACE}/data/environments/plugins-configuration.yaml ]]; then |
| 377 | PLUGINS_CONF_VOLUME_MOUNT="--volume ${PLUGIN_CONFIG_FILE}:${JETTY_BASE}/config/catalog-fe/plugins-configuration.yaml" |
| 378 | else |
| 379 | echo "INFO: '${PLUGIN_CONFIG_FILE}' not provided, ignoring..." |
| 380 | fi |
| 381 | |
| 382 | docker run \ |
| 383 | --detach \ |
| 384 | --name ${DOCKER_NAME} \ |
| 385 | --env HOST_IP=${IP} \ |
| 386 | --env ENVNAME="${DEP_ENV}" \ |
| 387 | --env JAVA_OPTIONS="${FE_JAVA_OPTIONS}" \ |
| 388 | --log-driver=json-file \ |
| 389 | --log-opt max-size=100m \ |
| 390 | --log-opt max-file=10 \ |
| 391 | --ulimit memlock=-1:-1 \ |
| 392 | --ulimit nofile=4096:100000 \ |
| 393 | --volume ${WORKSPACE}/data/logs/FE/:${JETTY_BASE}/logs \ |
MichaelMorris | a2abf6e | 2020-03-10 12:37:48 +0000 | [diff] [blame] | 394 | --volume ${WORKSPACE}/data/environments:/${JETTY_BASE}/chef-solo/environments \ |
Dmitry Puzikov | 0574f88 | 2020-03-05 18:03:15 +0100 | [diff] [blame] | 395 | ${LOCAL_TIME_MOUNT_CMD} \ |
| 396 | ${PLUGINS_CONF_VOLUME_MOUNT} \ |
| 397 | --publish 9443:9443 \ |
| 398 | --publish 8181:8181 \ |
| 399 | ${ADDITIONAL_ARGUMENTS} \ |
| 400 | ${IMAGE_NAME} |
| 401 | |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 402 | command_exit_status $? ${DOCKER_NAME} |
Dmitry Puzikov | 0574f88 | 2020-03-05 18:03:15 +0100 | [diff] [blame] | 403 | echo "Please wait while '${DOCKER_NAME}' container is starting..." |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 404 | monitor_docker ${DOCKER_NAME} |
| 405 | } |
| 406 | # |
| 407 | |
| 408 | |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 409 | # apis-sanity |
| 410 | function sdc-api-tests { |
| 411 | if [[ ${RUN_API_TESTS} = true ]] ; then |
Yuli Shlosberg | d0eaeca | 2018-07-19 17:54:15 +0300 | [diff] [blame] | 412 | healthCheck |
| 413 | healthCheck_http_code=$? |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 414 | if [[ ${healthCheck_http_code} == 200 ]] ; then |
| 415 | echo "docker run sdc-api-tests..." |
| 416 | echo "Trigger sdc-api-tests docker, please wait..." |
| 417 | |
| 418 | if [ ${LOCAL} = false ]; then |
| 419 | docker pull ${PREFIX}/sdc-api-tests:${RELEASE} |
| 420 | fi |
| 421 | |
AndyWalshe | c1835f3 | 2019-04-25 11:20:38 +0000 | [diff] [blame] | 422 | docker run --detach --name sdc-api-tests --env HOST_IP=${IP} --env ENVNAME="${DEP_ENV}" --env JAVA_OPTIONS="${API_TESTS_JAVA_OPTIONS}" --env SUITE_NAME=${API_SUITE} --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 ${LOCAL_TIME_MOUNT_CMD} --volume ${WORKSPACE}/data/logs/sdc-api-tests/target:/var/lib/tests/target --volume ${WORKSPACE}/data/logs/sdc-api-tests/ExtentReport:/var/lib/tests/ExtentReport --volume ${WORKSPACE}/data/logs/sdc-api-tests/outputCsar:/var/lib/tests/outputCsar --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments --volume ${WORKSPACE}/data/${SDC_CERT_DIR}:/var/lib/tests/cert --publish 9560:9560 ${PREFIX}/sdc-api-tests:${RELEASE} echo "please wait while SDC-API-TESTS is starting....." |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 423 | monitor_docker sdc-api-tests |
| 424 | fi |
| 425 | fi |
| 426 | } |
| 427 | # |
| 428 | |
| 429 | |
| 430 | # ui-sanity |
| 431 | function sdc-ui-tests { |
| 432 | |
| 433 | if [[ ${RUN_UI_TESTS} = true ]] ; then |
Yuli Shlosberg | d0eaeca | 2018-07-19 17:54:15 +0300 | [diff] [blame] | 434 | healthCheck |
| 435 | healthCheck_http_code=$? |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 436 | if [[ ${healthCheck_http_code} == 200 ]]; then |
| 437 | echo "docker run sdc-ui-tets..." |
| 438 | echo "Trigger sdc-ui-tests docker, please wait..." |
| 439 | |
| 440 | if [ ${LOCAL} = false ]; then |
| 441 | docker pull ${PREFIX}/sdc-ui-tests:${RELEASE} |
| 442 | fi |
Michael Lando | dc856bb | 2018-08-13 13:27:52 +0300 | [diff] [blame] | 443 | RUN_SIMULATOR=true; |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 444 | sdc-sim |
| 445 | docker run --detach --name sdc-ui-tests --env HOST_IP=${IP} --env ENVNAME="${DEP_ENV}" --env JAVA_OPTIONS="${UI_TESTS_JAVA_OPTIONS}" --env SUITE_NAME=${UI_SUITE} --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 ${LOCAL_TIME_MOUNT_CMD} --volume ${WORKSPACE}/data/logs/sdc-ui-tests/target:/var/lib/tests/target --volume ${WORKSPACE}/data/logs/sdc-ui-tests/ExtentReport:/var/lib/tests/ExtentReport --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments --publish 5901:5901 --publish 6901:6901 ${PREFIX}/sdc-ui-tests:${RELEASE} |
| 446 | echo "please wait while SDC-UI-TESTS is starting....." |
| 447 | monitor_docker sdc-ui-tests |
| 448 | fi |
| 449 | fi |
| 450 | } |
| 451 | # |
| 452 | |
| 453 | |
| 454 | # SDC-Simulator |
| 455 | function sdc-sim { |
Lianhao Lu | 2616684 | 2018-09-07 10:42:10 +0800 | [diff] [blame] | 456 | if [ "${RUN_SIMULATOR}" == true ]; then |
Michael Lando | dc856bb | 2018-08-13 13:27:52 +0300 | [diff] [blame] | 457 | echo "docker run sdc-webSimulator..." |
| 458 | if [ ${LOCAL} = false ]; then |
| 459 | docker pull ${PREFIX}/sdc-simulator:${RELEASE} |
| 460 | fi |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 461 | |
Michael Lando | dc856bb | 2018-08-13 13:27:52 +0300 | [diff] [blame] | 462 | probe_sim |
| 463 | sim_stat=$? |
Michael Lando | b751c96 | 2018-08-20 11:34:04 +0300 | [diff] [blame] | 464 | if [ ${sim_stat} == 1 ]; then |
Michael Lando | dc856bb | 2018-08-13 13:27:52 +0300 | [diff] [blame] | 465 | docker run \ |
| 466 | --detach \ |
| 467 | --name sdc-sim \ |
| 468 | --env FE_URL="${FE_URL}" \ |
| 469 | --env JAVA_OPTIONS="${SIM_JAVA_OPTIONS}" \ |
| 470 | --env ENVNAME="${DEP_ENV}" \ |
| 471 | ${LOCAL_TIME_MOUNT_CMD} \ |
andre.schmid | fa1db43 | 2019-10-29 17:18:22 +0000 | [diff] [blame] | 472 | --volume ${WORKSPACE}/data/logs/WS/:${JETTY_BASE}/logs \ |
Michael Lando | dc856bb | 2018-08-13 13:27:52 +0300 | [diff] [blame] | 473 | --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments \ |
| 474 | --publish 8285:8080 \ |
| 475 | --publish 8286:8443 ${PREFIX}/sdc-simulator:${RELEASE} |
| 476 | echo "please wait while SDC-WEB-SIMULATOR is starting....." |
| 477 | monitor_docker sdc-sim |
| 478 | fi |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 479 | fi |
| 480 | } |
| 481 | # |
| 482 | |
| 483 | |
| 484 | # |
| 485 | # Main |
| 486 | # |
| 487 | |
| 488 | # Handle command line arguments |
Idan Amit | db3d554 | 2017-12-07 11:33:32 +0200 | [diff] [blame] | 489 | while [ $# -gt 0 ]; do |
Michael Lando | 451a340 | 2017-02-19 10:28:42 +0200 | [diff] [blame] | 490 | case $1 in |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 491 | |
Idan Amit | db3d554 | 2017-12-07 11:33:32 +0200 | [diff] [blame] | 492 | # -r | --release - The specific docker version to pull and deploy |
Yuli Shlosberg | 0566f58 | 2017-11-26 19:05:23 +0200 | [diff] [blame] | 493 | -r | --release ) |
| 494 | shift 1 ; |
| 495 | RELEASE=$1; |
| 496 | shift 1;; |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 497 | |
Idan Amit | db3d554 | 2017-12-07 11:33:32 +0200 | [diff] [blame] | 498 | # -e | --environment - The environment name you want to deploy |
Yuli Shlosberg | 0566f58 | 2017-11-26 19:05:23 +0200 | [diff] [blame] | 499 | -e | --environment ) |
| 500 | shift 1; |
| 501 | DEP_ENV=$1; |
| 502 | shift 1 ;; |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 503 | |
Idan Amit | db3d554 | 2017-12-07 11:33:32 +0200 | [diff] [blame] | 504 | # -p | --port - The port from which to connect to the docker nexus |
Yuli Shlosberg | 0566f58 | 2017-11-26 19:05:23 +0200 | [diff] [blame] | 505 | -p | --port ) |
| 506 | shift 1 ; |
| 507 | PORT=$1; |
| 508 | shift 1 ;; |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 509 | |
Idan Amit | db3d554 | 2017-12-07 11:33:32 +0200 | [diff] [blame] | 510 | # -l | --local - Use this for deploying your local dockers without pulling them first |
Yuli Shlosberg | 0566f58 | 2017-11-26 19:05:23 +0200 | [diff] [blame] | 511 | -l | --local ) |
| 512 | LOCAL=true; |
| 513 | shift 1;; |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 514 | |
Yuli Shlosberg | f59a225 | 2018-03-21 11:14:08 +0200 | [diff] [blame] | 515 | # -ta - Use this for running the APIs sanity docker after all other dockers have been deployed |
| 516 | -ta ) |
| 517 | shift 1 ; |
| 518 | API_SUITE=$1; |
| 519 | RUN_API_TESTS=true; |
| 520 | shift 1 ;; |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 521 | |
Yuli Shlosberg | f59a225 | 2018-03-21 11:14:08 +0200 | [diff] [blame] | 522 | # -tu - Use this for running the UI sanity docker after all other dockers have been deployed |
| 523 | -tu ) |
| 524 | shift 1 ; |
| 525 | UI_SUITE=$1; |
| 526 | RUN_UI_TESTS=true; |
| 527 | shift 1 ;; |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 528 | |
Yuli Shlosberg | f59a225 | 2018-03-21 11:14:08 +0200 | [diff] [blame] | 529 | # -tad - Use this for running the DEFAULT suite of tests in APIs sanity docker after all other dockers have been deployed |
| 530 | -tad | -t ) |
| 531 | API_SUITE="onapApiSanity"; |
| 532 | RUN_API_TESTS=true; |
| 533 | shift 1 ;; |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 534 | |
Yuli Shlosberg | f59a225 | 2018-03-21 11:14:08 +0200 | [diff] [blame] | 535 | # -tud - Use this for running the DEFAULT suite of tests in UI sanity docker after all other dockers have been deployed |
| 536 | -tud ) |
| 537 | UI_SUITE="onapUiSanity"; |
| 538 | RUN_UI_TESTS=true; |
Yuli Shlosberg | 0566f58 | 2017-11-26 19:05:23 +0200 | [diff] [blame] | 539 | shift 1 ;; |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 540 | |
Yuli Shlosberg | 958c32d | 2018-02-15 12:04:46 +0200 | [diff] [blame] | 541 | # -d | --docker - The init specified docker |
| 542 | -d | --docker ) |
| 543 | shift 1 ; |
| 544 | DOCKER=$1; |
| 545 | shift 1 ;; |
Michael Lando | dc856bb | 2018-08-13 13:27:52 +0300 | [diff] [blame] | 546 | # -sim | --simulator run the simulator |
| 547 | -sim | --simulator ) |
kaihlavi | b237271 | 2019-05-27 16:28:23 +0300 | [diff] [blame] | 548 | RUN_SIMULATOR=true; |
| 549 | shift 1 ;; |
Michael Lando | dc856bb | 2018-08-13 13:27:52 +0300 | [diff] [blame] | 550 | # -sim | --simulator run the simulator |
| 551 | -u | --fe_url ) |
kaihlavi | b237271 | 2019-05-27 16:28:23 +0300 | [diff] [blame] | 552 | shift 1 ; |
| 553 | FE_URL=$1; |
| 554 | shift 1 ;; |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 555 | |
Idan Amit | db3d554 | 2017-12-07 11:33:32 +0200 | [diff] [blame] | 556 | # -h | --help - Display the help message with all the available run options |
Yuli Shlosberg | 0566f58 | 2017-11-26 19:05:23 +0200 | [diff] [blame] | 557 | -h | --help ) |
| 558 | usage; |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 559 | exit ${SUCCESS};; |
| 560 | |
Yuli Shlosberg | 0566f58 | 2017-11-26 19:05:23 +0200 | [diff] [blame] | 561 | * ) |
| 562 | usage; |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 563 | exit ${FAILURE};; |
Michael Lando | 451a340 | 2017-02-19 10:28:42 +0200 | [diff] [blame] | 564 | esac |
Michael Lando | 451a340 | 2017-02-19 10:28:42 +0200 | [diff] [blame] | 565 | done |
| 566 | |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 567 | |
liang ding | d73c287 | 2018-09-27 19:07:02 -0700 | [diff] [blame] | 568 | #Prefix those with WORKSPACE so it can be set to something other than /opt |
dekstroza | 8352006 | 2018-05-03 16:47:08 +0100 | [diff] [blame] | 569 | [ -f ${WORKSPACE}/opt/config/env_name.txt ] && DEP_ENV=$(cat ${WORKSPACE}/opt/config/env_name.txt) || echo ${DEP_ENV} |
| 570 | [ -f ${WORKSPACE}/opt/config/nexus_username.txt ] && NEXUS_USERNAME=$(cat ${WORKSPACE}/opt/config/nexus_username.txt) || NEXUS_USERNAME=release |
| 571 | [ -f ${WORKSPACE}/opt/config/nexus_password.txt ] && NEXUS_PASSWD=$(cat ${WORKSPACE}/opt/config/nexus_password.txt) || NEXUS_PASSWD=sfWU3DFVdBr7GVxB85mTYgAW |
| 572 | [ -f ${WORKSPACE}/opt/config/nexus_docker_repo.txt ] && NEXUS_DOCKER_REPO=$(cat ${WORKSPACE}/opt/config/nexus_docker_repo.txt) || NEXUS_DOCKER_REPO=nexus3.onap.org:${PORT} |
| 573 | [ -f ${WORKSPACE}/opt/config/nexus_username.txt ] && docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO |
Michael Lando | 451a340 | 2017-02-19 10:28:42 +0200 | [diff] [blame] | 574 | |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 575 | |
Yuli Shlosberg | d1bb2e5 | 2018-01-15 11:51:21 +0200 | [diff] [blame] | 576 | export IP=`ip route get 8.8.8.8 | awk '/src/{ print $7 }'` |
dekstroza | 8352006 | 2018-05-03 16:47:08 +0100 | [diff] [blame] | 577 | #If OSX, then use this to get IP |
| 578 | if [[ "$OSTYPE" == "darwin"* ]]; then |
| 579 | export IP=$(ipconfig getifaddr en0) |
| 580 | fi |
Idan Amit | db3d554 | 2017-12-07 11:33:32 +0200 | [diff] [blame] | 581 | export PREFIX=${NEXUS_DOCKER_REPO}'/onap' |
Idan Amit | c7f57ec | 2017-08-31 14:26:21 +0300 | [diff] [blame] | 582 | |
| 583 | if [ ${LOCAL} = true ]; then |
Idan Amit | db3d554 | 2017-12-07 11:33:32 +0200 | [diff] [blame] | 584 | PREFIX='onap' |
Idan Amit | c7f57ec | 2017-08-31 14:26:21 +0300 | [diff] [blame] | 585 | fi |
Michael Lando | 451a340 | 2017-02-19 10:28:42 +0200 | [diff] [blame] | 586 | |
| 587 | echo "" |
| 588 | |
Yuli Shlosberg | 958c32d | 2018-02-15 12:04:46 +0200 | [diff] [blame] | 589 | if [ -z "${DOCKER}" ]; then |
k.kedron | 3643cc5 | 2019-08-28 15:01:51 +0200 | [diff] [blame] | 590 | cleanup all |
| 591 | dir_perms |
k.kedron | 3643cc5 | 2019-08-28 15:01:51 +0200 | [diff] [blame] | 592 | sdc-cs |
| 593 | sdc-cs-init |
k.kedron | 3643cc5 | 2019-08-28 15:01:51 +0200 | [diff] [blame] | 594 | sdc-cs-onboard-init |
| 595 | sdc-onboard-BE |
| 596 | sdc-BE |
| 597 | sdc-BE-init |
| 598 | sdc-FE |
| 599 | healthCheck |
| 600 | sdc-sim |
| 601 | sdc-api-tests |
| 602 | sdc-ui-tests |
Yuli Shlosberg | 958c32d | 2018-02-15 12:04:46 +0200 | [diff] [blame] | 603 | else |
k.kedron | 3643cc5 | 2019-08-28 15:01:51 +0200 | [diff] [blame] | 604 | cleanup ${DOCKER} |
| 605 | dir_perms |
| 606 | ${DOCKER} |
| 607 | healthCheck |
Yuli Shlosberg | 958c32d | 2018-02-15 12:04:46 +0200 | [diff] [blame] | 608 | fi |