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