Create a upstream repos validator
[integration.git] / bootstrap / vagrant-onap / lib / appc
1 #!/bin/bash
2
3 set -o xtrace
4
5 source /var/onap/sdnc
6 source /var/onap/functions
7
8 appc_src_folder=$git_src_folder/appc
9 appc_repos=("appc" "appc/deployment")
10
11 # clone_all_appc_repos() - Function that clones APPC source repo.
12 function clone_all_appc_repos {
13     for repo in ${appc_repos[@]}; do
14         clone_repo $repo $appc_src_folder${repo#*appc}
15     done
16 }
17
18 # compile_all_appc_repos() - Function that compiles APPC source repo.
19 function compile_all_appc_repos {
20     for repo in ${appc_repos[@]}; do
21         compile_src $appc_src_folder${repo#*appc}
22     done
23 }
24
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 }
30
31 # get_appc_images() - Function that gets or build APPC docker images
32 function get_appc_images {
33     if [[ "$build_image" == "True" ]]; then
34         _build_appc_images
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
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
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 {
51     if [[ "$clone_repo" == "True" ]]; then
52         clone_all_appc_repos
53         if [[ "$compile_repo" == "True" ]]; then
54             compile_all_appc_repos
55         fi
56     fi
57
58     if [[ "$skip_get_images" == "False" ]]; then
59         get_appc_images
60         if [[ "$skip_install" == "False" ]]; then
61             install_appc
62         fi
63     fi
64 }