blob: 4d93f54e56192ffe23e61157f2a23cbdd598b0f8 [file] [log] [blame]
Victor Morales89ce3212017-06-16 18:32:48 -05001#!/bin/bash
2
3set -o xtrace
4
5source /var/onap/sdnc
Victor Morales65deef22017-08-18 20:53:42 -05006source /var/onap/functions
7
8appc_src_folder=$git_src_folder/appc
Victor Morales21404d72017-10-20 13:18:26 -07009appc_repos=("appc" "appc/deployment")
Victor Moralesdd074802017-07-26 16:06:35 -050010
11# clone_all_appc_repos() - Function that clones APPC source repo.
12function clone_all_appc_repos {
Victor Morales21404d72017-10-20 13:18:26 -070013 for repo in ${appc_repos[@]}; do
14 clone_repo $repo $appc_src_folder${repo#*appc}
15 done
Victor Moralesdd074802017-07-26 16:06:35 -050016}
17
18# compile_all_appc_repos() - Function that compiles APPC source repo.
19function compile_all_appc_repos {
Victor Morales21404d72017-10-20 13:18:26 -070020 for repo in ${appc_repos[@]}; do
21 compile_src $appc_src_folder${repo#*appc}
22 done
Victor Moralesdd074802017-07-26 16:06:35 -050023}
Victor Morales89ce3212017-06-16 18:32:48 -050024
Victor Morales65deef22017-08-18 20:53:42 -050025# _build_appc_images() - Function that creates APPC images from source code.
26function _build_appc_images {
27 get_sdnc_images
28 build_docker_image $appc_src_folder/deployment/installation/appc docker
29}
Victor Moralesdd074802017-07-26 16:06:35 -050030
Victor Morales65deef22017-08-18 20:53:42 -050031# get_appc_images() - Function that gets or build APPC docker images
32function get_appc_images {
Victor Morales89ce3212017-06-16 18:32:48 -050033 if [[ "$build_image" == "True" ]]; then
Victor Morales65deef22017-08-18 20:53:42 -050034 _build_appc_images
Victor Morales89ce3212017-06-16 18:32:48 -050035 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 Morales65deef22017-08-18 20:53:42 -050039}
40
41# install_appc() - Function that clones and installs the APPC services from source code
42function install_appc {
43 pushd $appc_src_folder/deployment/docker-compose
Victor Morales89ce3212017-06-16 18:32:48 -050044 install_docker_compose
45 /opt/docker/docker-compose up -d
46 popd
47}
48
49# init_appc() - Function that initialize APPC services
50function init_appc {
Idan Amit1690e082017-08-20 08:58:14 +030051 if [[ "$clone_repo" == "True" ]]; then
52 clone_all_appc_repos
53 if [[ "$compile_repo" == "True" ]]; then
54 compile_all_appc_repos
55 fi
Victor Morales65deef22017-08-18 20:53:42 -050056 fi
57
Victor Morales6a919972017-09-28 18:29:54 -070058 if [[ "$skip_get_images" == "False" ]]; then
59 get_appc_images
60 if [[ "$skip_install" == "False" ]]; then
61 install_appc
62 fi
63 fi
Victor Morales89ce3212017-06-16 18:32:48 -050064}