diff options
Diffstat (limited to 'sdc-os-chef/scripts/sanity_run.sh')
-rw-r--r-- | sdc-os-chef/scripts/sanity_run.sh | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/sdc-os-chef/scripts/sanity_run.sh b/sdc-os-chef/scripts/sanity_run.sh index 4aea3bb410..8898b92a81 100644 --- a/sdc-os-chef/scripts/sanity_run.sh +++ b/sdc-os-chef/scripts/sanity_run.sh @@ -1,5 +1,11 @@ #!/bin/bash +#Define this as variable, so it can be excluded in run commands on Docker for OSX, as /etc/localtime cant be mounted there. +LOCAL_TIME_MOUNT_CMD="--volume /etc/localtime:/etc/localtime:ro" +# If os is OSX, unset this, so /etc/localtime is not mounted, otherwise leave it be +if [[ "$OSTYPE" == "darwin"* ]]; then + LOCAL_TIME_MOUNT_CMD="" +fi function usage { echo "usage: sanity_run.sh [ -r|--release <RELEASE-NAME> ] [ -e|--environment <ENV-NAME> ] [ -p|--port <Docker-hub-port>] [ -l|--local <Run-without-pull>] [ -t|--runTests <Run-with-sanityDocker>] [ -h|--help ]" @@ -140,17 +146,21 @@ while [ $# -gt 0 ]; do done -[ -f /opt/config/env_name.txt ] && DEP_ENV=$(cat /opt/config/env_name.txt) || DEP_ENV=__ENV-NAME__ -[ -f /opt/config/nexus_username.txt ] && NEXUS_USERNAME=$(cat /opt/config/nexus_username.txt) || NEXUS_USERNAME=release -[ -f /opt/config/nexus_password.txt ] && NEXUS_PASSWD=$(cat /opt/config/nexus_password.txt) || NEXUS_PASSWD=sfWU3DFVdBr7GVxB85mTYgAW -[ -f /opt/config/nexus_docker_repo.txt ] && NEXUS_DOCKER_REPO=$(cat /opt/config/nexus_docker_repo.txt) || NEXUS_DOCKER_REPO=nexus3.onap.org:${PORT} -[ -f /opt/config/nexus_username.txt ] && docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO +[ -f ${WORKSPACE}/opt/config/env_name.txt ] && DEP_ENV=$(cat ${WORKSPACE}/opt/config/env_name.txt) || DEP_ENV=__ENV-NAME__ +[ -f ${WORKSPACE}/opt/config/nexus_username.txt ] && NEXUS_USERNAME=$(cat ${WORKSPACE}/opt/config/nexus_username.txt) || NEXUS_USERNAME=release +[ -f ${WORKSPACE}/opt/config/nexus_password.txt ] && NEXUS_PASSWD=$(cat ${WORKSPACE}/opt/config/nexus_password.txt) || NEXUS_PASSWD=sfWU3DFVdBr7GVxB85mTYgAW +[ -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} +[ -f ${WORKSPACE}/opt/config/nexus_username.txt ] && docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO cleanup export IP=`ip route get 8.8.8.8 | awk '/src/{ print $7 }'` +#If OSX, then use this to get IP +if [[ "$OSTYPE" == "darwin"* ]]; then + export IP=$(ipconfig getifaddr en0) +fi export PREFIX=${NEXUS_DOCKER_REPO}'/onap' if [ ${LOCAL} = true ]; then @@ -170,7 +180,7 @@ if [[ (${RUNTESTS} = true) && (${healthCheck_http_code} == 200) ]]; then docker pull ${PREFIX}/sdc-sanity:${RELEASE} fi -docker run --detach --name sdc-sanity --env HOST_IP=${IP} --env ENVNAME="${DEP_ENV}" --env http_proxy=${http_proxy} --env https_proxy=${https_proxy} --env no_proxy=${no_proxy} --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --memory 1500m --ulimit nofile=4096:100000 --volume /etc/localtime:/etc/localtime:ro --volume ${WORKSPACE}/data/logs/sdc-sanity/target:/var/lib/tests/target --volume ${WORKSPACE}/data/logs/sdc-sanity/ExtentReport:/var/lib/tests/ExtentReport --volume ${WORKSPACE}/data/logs/sdc-sanity/outputCsar:/var/lib/tests/outputCsar --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments --publish 9560:9560 ${PREFIX}/sdc-sanity:${RELEASE} +docker run --detach --name sdc-sanity --env HOST_IP=${IP} --env ENVNAME="${DEP_ENV}" --env http_proxy=${http_proxy} --env https_proxy=${https_proxy} --env no_proxy=${no_proxy} --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --memory 1500m --ulimit nofile=4096:100000 $LOCAL_TIME_MOUNT_CMD --volume ${WORKSPACE}/data/logs/sdc-sanity/target:/var/lib/tests/target --volume ${WORKSPACE}/data/logs/sdc-sanity/ExtentReport:/var/lib/tests/ExtentReport --volume ${WORKSPACE}/data/logs/sdc-sanity/outputCsar:/var/lib/tests/outputCsar --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments --publish 9560:9560 ${PREFIX}/sdc-sanity:${RELEASE} echo "please wait while SANITY is starting....." monitor_docker sdc-sanity |