blob: f4dc5fb20c68a2484b09c4474018d2b8885a830a [file] [log] [blame]
Victor Morales89ce3212017-06-16 18:32:48 -05001#!/bin/bash
2
3set -o xtrace
4
Victor Moralesdd074802017-07-26 16:06:35 -05005source /var/onap/functions
Victor Morales165f3e32017-08-08 16:24:05 -05006
7src_folder=$git_src_folder/policy
8policy_repos=("api" "common" "docker" "drools-applications" "drools-pdp" "engine" "gui" "pap" "pdp")
Victor Moralesdd074802017-07-26 16:06:35 -05009
10# clone_all_policy_repos() - Function that clones Policy source repo.
11function clone_all_policy_repos {
Victor Morales165f3e32017-08-08 16:24:05 -050012 for dirc in ${aai_repos[@]}; do
Victor Moralesdd074802017-07-26 16:06:35 -050013 clone_repo policy/$dirc $src_folder/$dirc
14 done
15}
16
17# # compile_all_policy_repos() - Function that compiles Policy source repo.
18function compile_all_policy_repos {
Victor Morales165f3e32017-08-08 16:24:05 -050019 for dirc in ${aai_repos[@]}; do
Victor Moralesdd074802017-07-26 16:06:35 -050020 compile_src $src_folder/$dirc
21 done
22}
23
Victor Morales89ce3212017-06-16 18:32:48 -050024# install_policy() - Function that clones and installs the Policy services from source code
25function install_policy {
Victor Moralesdd074802017-07-26 16:06:35 -050026 if [[ "$build_image" == "True" ]]; then
27 compile_src $src_folder/docker
28 install_docker
29 pushd $src_folder/docker
Victor Morales165f3e32017-08-08 16:24:05 -050030 install_maven
31 mvn prepare-package
32 cp -r target/policy-pe/* policy-pe/
33 cp -r target/policy-drools/* policy-drools
Victor Moralesdd074802017-07-26 16:06:35 -050034 bash docker_verify.sh
35 for image in os nexus db base drools pe; do
36 asserts_image onap/policy/policy-$image
37 done
38 popd
39 else
40 pull_onap_image policy/policy-db onap/policy/policy-db:latest
41 pull_onap_image policy/policy-pe onap/policy/policy-pe:latest
42 pull_onap_image policy/policy-drools onap/policy/policy-drools:latest
43 pull_onap_image policy/policy-nexus onap/policy/policy-nexus:latest
44 fi
45 pushd $src_folder/docker
Victor Morales89ce3212017-06-16 18:32:48 -050046 chmod +x config/drools/drools-tweaks.sh
Victor Morales89ce3212017-06-16 18:32:48 -050047 echo $IP_ADDRESS > config/pe/ip_addr.txt
48 install_docker_compose
49 /opt/docker/docker-compose up -d
50 popd
51}
52
53# init_policy() - Function that initialize Policy services
54function init_policy {
Victor Morales165f3e32017-08-08 16:24:05 -050055 clone_all_policy_repos
56 if [[ "$compile_repo" == "True" ]]; then
57 compile_all_policy_repos
58 fi
59
Victor Morales89ce3212017-06-16 18:32:48 -050060 install_policy
61}