Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 3 | source /var/onap/functions |
Victor Morales | 165f3e3 | 2017-08-08 16:24:05 -0500 | [diff] [blame] | 4 | |
Victor Morales | 9651265 | 2017-08-16 13:44:28 -0500 | [diff] [blame] | 5 | # _build_policy_images() - Function that build Policy docker images from source code |
| 6 | function _build_policy_images { |
Victor Morales | f8730f5 | 2018-03-02 13:24:33 -0800 | [diff] [blame] | 7 | compile_src ${src_folders[policy]}/docker |
| 8 | pushd ${src_folders[policy]}/docker |
Victor Morales | 9651265 | 2017-08-16 13:44:28 -0500 | [diff] [blame] | 9 | 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 |
| 19 | function get_policy_images { |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 20 | if [[ "$build_image" == "True" ]]; then |
Victor Morales | 9651265 | 2017-08-16 13:44:28 -0500 | [diff] [blame] | 21 | _build_policy_images |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 22 | else |
Victor Morales | f8730f5 | 2018-03-02 13:24:33 -0800 | [diff] [blame] | 23 | for image in db pe drools nexus; do |
| 24 | pull_onap_image policy/policy-$image onap/policy/policy-$image:latest |
| 25 | done |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 26 | fi |
Victor Morales | 9651265 | 2017-08-16 13:44:28 -0500 | [diff] [blame] | 27 | } |
| 28 | |
| 29 | # install_policy() - Function that clones and installs the Policy services from source code |
| 30 | function install_policy { |
Victor Morales | f8730f5 | 2018-03-02 13:24:33 -0800 | [diff] [blame] | 31 | pushd ${src_folders[policy]}/docker |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 32 | chmod +x config/drools/drools-tweaks.sh |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 33 | echo $IP_ADDRESS > config/pe/ip_addr.txt |
Victor Morales | 96fe388 | 2018-03-02 14:08:39 -0800 | [diff] [blame^] | 34 | run_docker_compose . |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 35 | popd |
| 36 | } |
| 37 | |
| 38 | # init_policy() - Function that initialize Policy services |
| 39 | function init_policy { |
Idan Amit | 1690e08 | 2017-08-20 08:58:14 +0300 | [diff] [blame] | 40 | if [[ "$clone_repo" == "True" ]]; then |
Victor Morales | f1f1ba5 | 2017-11-20 16:38:28 -0800 | [diff] [blame] | 41 | clone_repos "policy" |
Idan Amit | 1690e08 | 2017-08-20 08:58:14 +0300 | [diff] [blame] | 42 | if [[ "$compile_repo" == "True" ]]; then |
Victor Morales | f1f1ba5 | 2017-11-20 16:38:28 -0800 | [diff] [blame] | 43 | compile_repos "policy" |
Idan Amit | 1690e08 | 2017-08-20 08:58:14 +0300 | [diff] [blame] | 44 | fi |
Victor Morales | 165f3e3 | 2017-08-08 16:24:05 -0500 | [diff] [blame] | 45 | fi |
| 46 | |
Victor Morales | 6a91997 | 2017-09-28 18:29:54 -0700 | [diff] [blame] | 47 | if [[ "$skip_get_images" == "False" ]]; then |
| 48 | get_policy_images |
| 49 | if [[ "$skip_install" == "False" ]]; then |
| 50 | install_policy |
| 51 | fi |
| 52 | fi |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 53 | } |