blob: e66102c6703324328daf344fa06cbb79d9ce99d1 [file] [log] [blame]
Michael Mokry88f4d472019-03-04 12:00:05 -06001#!/bin/bash
2# ============LICENSE_START=======================================================
3# Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
4# ================================================================================
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16#
17# SPDX-License-Identifier: Apache-2.0
18# ============LICENSE_END=========================================================
19
Bilal Ad46ab2e2019-06-07 21:25:59 +000020source ${SCRIPTS}/policy/config/policy-csit.conf
21export POLICY_MARIADB_VER
22echo ${GERRIT_BRANCH}
23echo ${POLICY_MARIADB_VER}
24
Michael Mokryb4f69622019-05-13 13:09:17 -050025echo "Uninstall docker-py and reinstall docker."
26pip uninstall -y docker-py
27pip uninstall -y docker
28pip install -U docker==2.7.0
29
30# the directory of the script
31DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
32echo ${DIR}
33
34# the temp directory used, within $DIR
35# omit the -p parameter to create a temporal directory in the default location
36WORK_DIR=`mktemp -d -p "$DIR"`
37echo ${WORK_DIR}
38
39cd ${WORK_DIR}
40
41# check if tmp dir was created
42if [[ ! "$WORK_DIR" || ! -d "$WORK_DIR" ]]; then
43 echo "Could not create temp dir"
44 exit 1
45fi
46
47# bring down maven
48mkdir maven
49cd maven
Martin Klozikf5ae3482019-09-04 10:24:25 +020050# download maven from automatically selected mirror server
51curl -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"
52if ! tar -xzvf apache-maven-3.3.9-bin.tar.gz ; then
53 echo "Installation of maven has failed!"
54 exit 1
55fi
Michael Mokryb4f69622019-05-13 13:09:17 -050056ls -l
57export PATH=${PATH}:${WORK_DIR}/maven/apache-maven-3.3.9/bin
58${WORK_DIR}/maven/apache-maven-3.3.9/bin/mvn -v
59cd ..
60
61git clone http://gerrit.onap.org/r/oparent
Bilal Ad46ab2e2019-06-07 21:25:59 +000062git clone --depth 1 https://gerrit.onap.org/r/policy/models -b ${GERRIT_BRANCH}
Michael Mokryb4f69622019-05-13 13:09:17 -050063cd models/models-sim/models-sim-dmaap
64${WORK_DIR}/maven/apache-maven-3.3.9/bin/mvn clean install -DskipTests --settings ${WORK_DIR}/oparent/settings.xml
65bash ./src/main/package/docker/docker_build.sh
66cd ${WORKSPACE}
67rm -rf ${WORK_DIR}
68sleep 3
69
Bilal Ad46ab2e2019-06-07 21:25:59 +000070
71
72sudo apt-get -y install libxml2-utils
Bilal A71e57372019-12-17 02:17:57 +000073POLICY_API_VERSION_EXTRACT="$(curl -q --silent https://git.onap.org/policy/api/plain/pom.xml?h=${GERRIT_BRANCH} | xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' -)"
74export POLICY_API_VERSION="${POLICY_API_VERSION_EXTRACT:0:3}-SNAPSHOT-latest"
75POLICY_PAP_VERSION_EXTRACT="$(curl -q --silent https://git.onap.org/policy/pap/plain/pom.xml?h=${GERRIT_BRANCH} | xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' -)"
76export POLICY_PAP_VERSION="${POLICY_PAP_VERSION_EXTRACT:0:3}-SNAPSHOT-latest"
77POLICY_XACML_PDP_VERSION_EXTRACT="$(curl -q --silent https://git.onap.org/policy/xacml-pdp/plain/pom.xml?h=${GERRIT_BRANCH} | xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' -)"
78export POLICY_XACML_PDP_VERSION="${POLICY_XACML_PDP_VERSION_EXTRACT:0:3}-SNAPSHOT-latest"
Bilal Ad46ab2e2019-06-07 21:25:59 +000079
80echo ${POLICY_API_VERSION}
81echo ${POLICY_PAP_VERSION}
82echo ${POLICY_XACML_PDP_VERSION}
Michael Mokryb4f69622019-05-13 13:09:17 -050083# Adding this waiting container due to race condition between pap and mariadb
84docker-compose -f ${WORKSPACE}/scripts/policy/policy-xacml-pdp/docker-compose-pdpx.yml run --rm start_dependencies
Jim Hahn954af932019-06-03 15:00:08 -040085
86#Configure the database
87docker exec -it mariadb chmod +x /docker-entrypoint-initdb.d/db.sh
88docker exec -it mariadb /docker-entrypoint-initdb.d/db.sh
89
90# now bring everything else up
91docker-compose -f ${WORKSPACE}/scripts/policy/policy-xacml-pdp/docker-compose-pdpx.yml run --rm start_all
Michael Mokryb4f69622019-05-13 13:09:17 -050092
93unset http_proxy https_proxy
94
95POLICY_API_IP=`get-instance-ip.sh policy-api`
96MARIADB_IP=`get-instance-ip.sh mariadb`
Michael Mokry88f4d472019-03-04 12:00:05 -060097POLICY_PDPX_IP=`get-instance-ip.sh policy-xacml-pdp`
Michael Mokryb4f69622019-05-13 13:09:17 -050098DMAAP_IP=`get-instance-ip.sh dmaap-simulator`
99POLICY_PAP_IP=`get-instance-ip.sh policy-pap`
100
101
102echo PDP IP IS ${POLICY_PDPX_IP}
103echo API IP IS ${POLICY_API_IP}
104echo PAP IP IS ${POLICY_PAP_IP}
105echo MARIADB IP IS ${MARIADB_IP}
106echo DMAAP_IP IS ${DMAAP_IP}
107
Michael Mokryb4f69622019-05-13 13:09:17 -0500108ROBOT_VARIABLES="-v POLICY_PDPX_IP:${POLICY_PDPX_IP} -v POLICY_API_IP:${POLICY_API_IP} -v POLICY_PAP_IP:${POLICY_PAP_IP}"