Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 3 | source /var/onap/sdnc |
Victor Morales | 65deef2 | 2017-08-18 20:53:42 -0500 | [diff] [blame] | 4 | source /var/onap/functions |
| 5 | |
| 6 | appc_src_folder=$git_src_folder/appc |
Victor Morales | 21404d7 | 2017-10-20 13:18:26 -0700 | [diff] [blame] | 7 | appc_repos=("appc" "appc/deployment") |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 8 | |
| 9 | # clone_all_appc_repos() - Function that clones APPC source repo. |
| 10 | function clone_all_appc_repos { |
Victor Morales | 21404d7 | 2017-10-20 13:18:26 -0700 | [diff] [blame] | 11 | for repo in ${appc_repos[@]}; do |
| 12 | clone_repo $repo $appc_src_folder${repo#*appc} |
| 13 | done |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 14 | } |
| 15 | |
| 16 | # compile_all_appc_repos() - Function that compiles APPC source repo. |
| 17 | function compile_all_appc_repos { |
Victor Morales | 21404d7 | 2017-10-20 13:18:26 -0700 | [diff] [blame] | 18 | for repo in ${appc_repos[@]}; do |
| 19 | compile_src $appc_src_folder${repo#*appc} |
| 20 | done |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 21 | } |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 22 | |
Victor Morales | 65deef2 | 2017-08-18 20:53:42 -0500 | [diff] [blame] | 23 | # _build_appc_images() - Function that creates APPC images from source code. |
| 24 | function _build_appc_images { |
| 25 | get_sdnc_images |
| 26 | build_docker_image $appc_src_folder/deployment/installation/appc docker |
| 27 | } |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 28 | |
Victor Morales | 65deef2 | 2017-08-18 20:53:42 -0500 | [diff] [blame] | 29 | # get_appc_images() - Function that gets or build APPC docker images |
| 30 | function get_appc_images { |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 31 | if [[ "$build_image" == "True" ]]; then |
Victor Morales | 65deef2 | 2017-08-18 20:53:42 -0500 | [diff] [blame] | 32 | _build_appc_images |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 33 | else |
| 34 | pull_openecomp_image appc-image openecomp/appc-image:latest |
| 35 | pull_openecomp_image dgbuilder-sdnc-image openecomp/dgbuilder-sdnc-image:latest |
| 36 | fi |
Victor Morales | 65deef2 | 2017-08-18 20:53:42 -0500 | [diff] [blame] | 37 | } |
| 38 | |
| 39 | # install_appc() - Function that clones and installs the APPC services from source code |
| 40 | function install_appc { |
| 41 | pushd $appc_src_folder/deployment/docker-compose |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 42 | install_docker_compose |
| 43 | /opt/docker/docker-compose up -d |
| 44 | popd |
| 45 | } |
| 46 | |
| 47 | # init_appc() - Function that initialize APPC services |
| 48 | function init_appc { |
Idan Amit | 1690e08 | 2017-08-20 08:58:14 +0300 | [diff] [blame] | 49 | if [[ "$clone_repo" == "True" ]]; then |
| 50 | clone_all_appc_repos |
| 51 | if [[ "$compile_repo" == "True" ]]; then |
| 52 | compile_all_appc_repos |
| 53 | fi |
Victor Morales | 65deef2 | 2017-08-18 20:53:42 -0500 | [diff] [blame] | 54 | fi |
| 55 | |
Victor Morales | 6a91997 | 2017-09-28 18:29:54 -0700 | [diff] [blame] | 56 | if [[ "$skip_get_images" == "False" ]]; then |
| 57 | get_appc_images |
| 58 | if [[ "$skip_install" == "False" ]]; then |
| 59 | install_appc |
| 60 | fi |
| 61 | fi |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 62 | } |