blob: 181c73f1fa08991449786ccd270b3ffd21db40f4 [file] [log] [blame]
Victor Morales89ce3212017-06-16 18:32:48 -05001#!/bin/bash
2
Victor Morales89ce3212017-06-16 18:32:48 -05003source /var/onap/sdnc
Victor Morales65deef22017-08-18 20:53:42 -05004source /var/onap/functions
5
6appc_src_folder=$git_src_folder/appc
Victor Morales21404d72017-10-20 13:18:26 -07007appc_repos=("appc" "appc/deployment")
Victor Moralesdd074802017-07-26 16:06:35 -05008
9# clone_all_appc_repos() - Function that clones APPC source repo.
10function clone_all_appc_repos {
Victor Morales21404d72017-10-20 13:18:26 -070011 for repo in ${appc_repos[@]}; do
12 clone_repo $repo $appc_src_folder${repo#*appc}
13 done
Victor Moralesdd074802017-07-26 16:06:35 -050014}
15
16# compile_all_appc_repos() - Function that compiles APPC source repo.
17function compile_all_appc_repos {
Victor Morales21404d72017-10-20 13:18:26 -070018 for repo in ${appc_repos[@]}; do
19 compile_src $appc_src_folder${repo#*appc}
20 done
Victor Moralesdd074802017-07-26 16:06:35 -050021}
Victor Morales89ce3212017-06-16 18:32:48 -050022
Victor Morales65deef22017-08-18 20:53:42 -050023# _build_appc_images() - Function that creates APPC images from source code.
24function _build_appc_images {
25 get_sdnc_images
26 build_docker_image $appc_src_folder/deployment/installation/appc docker
27}
Victor Moralesdd074802017-07-26 16:06:35 -050028
Victor Morales65deef22017-08-18 20:53:42 -050029# get_appc_images() - Function that gets or build APPC docker images
30function get_appc_images {
Victor Morales89ce3212017-06-16 18:32:48 -050031 if [[ "$build_image" == "True" ]]; then
Victor Morales65deef22017-08-18 20:53:42 -050032 _build_appc_images
Victor Morales89ce3212017-06-16 18:32:48 -050033 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 Morales65deef22017-08-18 20:53:42 -050037}
38
39# install_appc() - Function that clones and installs the APPC services from source code
40function install_appc {
41 pushd $appc_src_folder/deployment/docker-compose
Victor Morales89ce3212017-06-16 18:32:48 -050042 install_docker_compose
43 /opt/docker/docker-compose up -d
44 popd
45}
46
47# init_appc() - Function that initialize APPC services
48function init_appc {
Idan Amit1690e082017-08-20 08:58:14 +030049 if [[ "$clone_repo" == "True" ]]; then
50 clone_all_appc_repos
51 if [[ "$compile_repo" == "True" ]]; then
52 compile_all_appc_repos
53 fi
Victor Morales65deef22017-08-18 20:53:42 -050054 fi
55
Victor Morales6a919972017-09-28 18:29:54 -070056 if [[ "$skip_get_images" == "False" ]]; then
57 get_appc_images
58 if [[ "$skip_install" == "False" ]]; then
59 install_appc
60 fi
61 fi
Victor Morales89ce3212017-06-16 18:32:48 -050062}