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