5e3858f160addca2396657a9afa2279bcf4ed215
[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
10 # clone_all_appc_repos() - Function that clones APPC source repo.
11 function clone_all_appc_repos {
12     clone_repo appc $appc_src_folder
13     clone_repo appc/deployment $appc_src_folder/deployment
14 }
15
16 # compile_all_appc_repos() - Function that compiles APPC source repo.
17 function compile_all_appc_repos {
18     compile_src $appc_src_folder
19     compile_src $appc_src_folder/deployment
20 }
21
22 # _build_appc_images() - Function that creates APPC images from source code.
23 function _build_appc_images {
24     get_sdnc_images
25     build_docker_image $appc_src_folder/deployment/installation/appc docker
26 }
27
28 # get_appc_images() - Function that gets or build APPC docker images
29 function get_appc_images {
30     if [[ "$build_image" == "True" ]]; then
31         _build_appc_images
32     else
33         pull_openecomp_image appc-image openecomp/appc-image:latest
34         pull_openecomp_image dgbuilder-sdnc-image openecomp/dgbuilder-sdnc-image:latest
35     fi
36 }
37
38 # install_appc() - Function that clones and installs the APPC services from source code
39 function install_appc {
40     pushd $appc_src_folder/deployment/docker-compose
41     install_docker_compose
42     /opt/docker/docker-compose up -d
43     popd
44 }
45
46 # init_appc() - Function that initialize APPC services
47 function init_appc {
48     if [[ "$clone_repo" == "True" ]]; then
49         clone_all_appc_repos
50         if [[ "$compile_repo" == "True" ]]; then
51             compile_all_appc_repos
52         fi
53     fi
54
55     if [[ "$skip_get_images" == "False" ]]; then
56         get_appc_images
57         if [[ "$skip_install" == "False" ]]; then
58             install_appc
59         fi
60     fi
61 }