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