Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # ============LICENSE_START======================================================= |
| 3 | # Copyright (C) 2018 Ericsson. All rights reserved. |
a.sreekumar | 7d80c38 | 2019-05-07 13:36:39 +0000 | [diff] [blame] | 4 | # |
| 5 | # Modifications copyright (c) 2019 Nordix Foundation. |
Jim Hahn | 954af93 | 2019-06-03 15:00:08 -0400 | [diff] [blame] | 6 | # Modifications Copyright (C) 2019 AT&T Intellectual Property. |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 7 | # ================================================================================ |
| 8 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 9 | # you may not use this file except in compliance with the License. |
| 10 | # You may obtain a copy of the License at |
| 11 | # |
| 12 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 13 | # |
| 14 | # Unless required by applicable law or agreed to in writing, software |
| 15 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 17 | # See the License for the specific language governing permissions and |
| 18 | # limitations under the License. |
| 19 | # |
| 20 | # SPDX-License-Identifier: Apache-2.0 |
| 21 | # ============LICENSE_END========================================================= |
Bilal A | d46ab2e | 2019-06-07 21:25:59 +0000 | [diff] [blame] | 22 | source ${SCRIPTS}/policy/config/policy-csit.conf |
| 23 | export POLICY_MARIADB_VER |
| 24 | echo ${GERRIT_BRANCH} |
| 25 | echo ${POLICY_MARIADB_VER} |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 26 | |
a.sreekumar | 7d80c38 | 2019-05-07 13:36:39 +0000 | [diff] [blame] | 27 | echo "Uninstall docker-py and reinstall docker." |
| 28 | pip uninstall -y docker-py |
| 29 | pip uninstall -y docker |
| 30 | pip install -U docker==2.7.0 |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 31 | |
a.sreekumar | 7d80c38 | 2019-05-07 13:36:39 +0000 | [diff] [blame] | 32 | # the directory of the script |
| 33 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" |
| 34 | echo ${DIR} |
| 35 | |
| 36 | # the temp directory used, within $DIR |
| 37 | # omit the -p parameter to create a temporal directory in the default location |
| 38 | WORK_DIR=`mktemp -d -p "$DIR"` |
| 39 | echo ${WORK_DIR} |
| 40 | |
| 41 | cd ${WORK_DIR} |
| 42 | |
| 43 | # check if tmp dir was created |
| 44 | if [[ ! "$WORK_DIR" || ! -d "$WORK_DIR" ]]; then |
| 45 | echo "Could not create temp dir" |
| 46 | exit 1 |
| 47 | fi |
| 48 | |
| 49 | # bring down maven |
| 50 | mkdir maven |
| 51 | cd maven |
Martin Klozik | f5ae348 | 2019-09-04 10:24:25 +0200 | [diff] [blame] | 52 | # download maven from automatically selected mirror server |
| 53 | curl -vLO "https://www.apache.org/dyn/mirrors/mirrors.cgi?cca2=us&preferred=http://apache.claz.org/&action=download&filename=maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz" |
| 54 | if ! tar -xzvf apache-maven-3.3.9-bin.tar.gz ; then |
| 55 | echo "Installation of maven has failed!" |
| 56 | exit 1 |
| 57 | fi |
a.sreekumar | 7d80c38 | 2019-05-07 13:36:39 +0000 | [diff] [blame] | 58 | ls -l |
| 59 | export PATH=${PATH}:${WORK_DIR}/maven/apache-maven-3.3.9/bin |
| 60 | ${WORK_DIR}/maven/apache-maven-3.3.9/bin/mvn -v |
| 61 | cd .. |
| 62 | |
| 63 | git clone http://gerrit.onap.org/r/oparent |
Bilal A | d46ab2e | 2019-06-07 21:25:59 +0000 | [diff] [blame] | 64 | git clone --depth 1 https://gerrit.onap.org/r/policy/models -b ${GERRIT_BRANCH} |
a.sreekumar | 7d80c38 | 2019-05-07 13:36:39 +0000 | [diff] [blame] | 65 | cd models/models-sim/models-sim-dmaap |
| 66 | ${WORK_DIR}/maven/apache-maven-3.3.9/bin/mvn clean install -DskipTests --settings ${WORK_DIR}/oparent/settings.xml |
| 67 | bash ./src/main/package/docker/docker_build.sh |
| 68 | cd ${WORKSPACE} |
| 69 | rm -rf ${WORK_DIR} |
| 70 | sleep 3 |
| 71 | |
Bilal A | d46ab2e | 2019-06-07 21:25:59 +0000 | [diff] [blame] | 72 | sudo apt-get -y install libxml2-utils |
| 73 | export POLICY_API_VERSION="$(curl -q --silent https://git.onap.org/policy/api/plain/pom.xml?h=${GERRIT_BRANCH} | xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' -)" |
| 74 | export POLICY_PAP_VERSION="$(curl -q --silent https://git.onap.org/policy/pap/plain/pom.xml?h=${GERRIT_BRANCH} | xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' -)" |
| 75 | export POLICY_APEX_PDP_VERSION="$(curl -q --silent https://git.onap.org/policy/apex-pdp/plain/pom.xml?h=${GERRIT_BRANCH} | xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' -)" |
| 76 | |
| 77 | echo ${POLICY_API_VERSION} |
| 78 | echo ${POLICY_PAP_VERSION} |
| 79 | echo ${POLICY_APEX_PDP_VERSION} |
| 80 | |
a.sreekumar | 7d80c38 | 2019-05-07 13:36:39 +0000 | [diff] [blame] | 81 | # Adding this waiting container due to race condition between pap and mariadb |
| 82 | docker-compose -f ${WORKSPACE}/scripts/policy/policy-apex-pdp/docker-compose-apex.yml run --rm start_dependencies |
Jim Hahn | 954af93 | 2019-06-03 15:00:08 -0400 | [diff] [blame] | 83 | |
| 84 | #Configure the database |
| 85 | docker exec -it mariadb chmod +x /docker-entrypoint-initdb.d/db.sh |
| 86 | docker exec -it mariadb /docker-entrypoint-initdb.d/db.sh |
| 87 | |
| 88 | # now bring everything else up |
| 89 | docker-compose -f ${WORKSPACE}/scripts/policy/policy-apex-pdp/docker-compose-apex.yml run --rm start_all |
| 90 | |
| 91 | unset http_proxy https_proxy |
a.sreekumar | 7d80c38 | 2019-05-07 13:36:39 +0000 | [diff] [blame] | 92 | |
| 93 | POLICY_API_IP=`get-instance-ip.sh policy-api` |
| 94 | POLICY_PAP_IP=`get-instance-ip.sh policy-pap` |
| 95 | MARIADB_IP=`get-instance-ip.sh mariadb` |
| 96 | APEX_IP=`get-instance-ip.sh policy-apex-pdp` |
| 97 | DMAAP_IP=`get-instance-ip.sh dmaap-simulator` |
| 98 | |
| 99 | echo PAP IP IS ${POLICY_PAP_IP} |
| 100 | echo MARIADB IP IS ${MARIADB_IP} |
| 101 | echo API IP IS ${POLICY_API_IP} |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 102 | echo APEX IP IS ${APEX_IP} |
a.sreekumar | 7d80c38 | 2019-05-07 13:36:39 +0000 | [diff] [blame] | 103 | echo DMAAP_IP IS ${DMAAP_IP} |
| 104 | |
a.sreekumar | 7d80c38 | 2019-05-07 13:36:39 +0000 | [diff] [blame] | 105 | ROBOT_VARIABLES="-v APEX_IP:${APEX_IP} -v POLICY_API_IP:${POLICY_API_IP} -v POLICY_PAP_IP:${POLICY_PAP_IP}" |