blob: 1e633bef1e20a49b60ef5806084290f6ef70876c [file] [log] [blame]
Victor Morales89ce3212017-06-16 18:32:48 -05001#!/bin/bash
2
Victor Moralesdd074802017-07-26 16:06:35 -05003source /var/onap/functions
Victor Morales165f3e32017-08-08 16:24:05 -05004
Victor Morales96512652017-08-16 13:44:28 -05005# _build_policy_images() - Function that build Policy docker images from source code
6function _build_policy_images {
Victor Moralesf8730f52018-03-02 13:24:33 -08007 compile_src ${src_folders[policy]}/docker
8 pushd ${src_folders[policy]}/docker
Victor Morales96512652017-08-16 13:44:28 -05009 install_maven
10 mvn prepare-package
11 cp -r target/policy-pe/* policy-pe/
12 cp -r target/policy-drools/* policy-drools
13 install_docker
14 bash docker_verify.sh
15 popd
16}
17
18# get_policy_images() - Function that retrieves Policy docker images
19function get_policy_images {
Victor Moralesdd074802017-07-26 16:06:35 -050020 if [[ "$build_image" == "True" ]]; then
Victor Morales96512652017-08-16 13:44:28 -050021 _build_policy_images
Victor Moralesdd074802017-07-26 16:06:35 -050022 else
Victor Moralesf8730f52018-03-02 13:24:33 -080023 for image in db pe drools nexus; do
24 pull_onap_image policy/policy-$image onap/policy/policy-$image:latest
25 done
Victor Moralesdd074802017-07-26 16:06:35 -050026 fi
Victor Morales96512652017-08-16 13:44:28 -050027}
28
29# install_policy() - Function that clones and installs the Policy services from source code
30function install_policy {
Victor Moralesf8730f52018-03-02 13:24:33 -080031 pushd ${src_folders[policy]}/docker
Victor Morales89ce3212017-06-16 18:32:48 -050032 chmod +x config/drools/drools-tweaks.sh
Victor Morales89ce3212017-06-16 18:32:48 -050033 echo $IP_ADDRESS > config/pe/ip_addr.txt
Victor Morales96fe3882018-03-02 14:08:39 -080034 run_docker_compose .
Victor Morales89ce3212017-06-16 18:32:48 -050035 popd
36}
37
38# init_policy() - Function that initialize Policy services
39function init_policy {
Idan Amit1690e082017-08-20 08:58:14 +030040 if [[ "$clone_repo" == "True" ]]; then
Victor Moralesf1f1ba52017-11-20 16:38:28 -080041 clone_repos "policy"
Idan Amit1690e082017-08-20 08:58:14 +030042 if [[ "$compile_repo" == "True" ]]; then
Victor Moralesf1f1ba52017-11-20 16:38:28 -080043 compile_repos "policy"
Idan Amit1690e082017-08-20 08:58:14 +030044 fi
Victor Morales165f3e32017-08-08 16:24:05 -050045 fi
46
Victor Morales6a919972017-09-28 18:29:54 -070047 if [[ "$skip_get_images" == "False" ]]; then
48 get_policy_images
49 if [[ "$skip_install" == "False" ]]; then
50 install_policy
51 fi
52 fi
Victor Morales89ce3212017-06-16 18:32:48 -050053}