blob: c23ed8581834149e7ad47be890b7c562ff9f837a [file] [log] [blame]
Shashank Kumar Shankard52d0af2017-10-20 16:06:08 -07001#!/bin/bash
2
3set -o xtrace
4
5source /var/onap/functions
6
7vnfsdk_src_folder=$git_src_folder/vnfsdk
Victor Morales6d280a12017-10-23 11:56:43 -07008vnfsdk_repos=("vnfsdk/compliance" "vnfsdk/functest" "vnfsdk/lctest" "vnfsdk/model" "vnfsdk/pkgtools" "vnfsdk/refrepo" "vnfsdk/validation")
Shashank Kumar Shankard52d0af2017-10-20 16:06:08 -07009
10# clone_all_vnfsdk_repos() - Function that clones vnfsdk source repo.
11function clone_all_vnfsdk_repos {
Victor Morales6d280a12017-10-23 11:56:43 -070012 for repo in ${vnfsdk_repos[@]}; do
13 clone_repo $repo $vnfsdk_src_folder${repo#*vnfsdk}
Shashank Kumar Shankard52d0af2017-10-20 16:06:08 -070014 done
15}
16
17# compile_all_vnfsdk_repos - Function that builds vnfsdk source repo
18function compile_all_vnfsdk_repos {
Victor Morales6d280a12017-10-23 11:56:43 -070019 for repo in ${vnfsdk_repos[@]}; do
20 compile_src $vnfsdk_src_folder${repo#*vnfsdk}
Shashank Kumar Shankard52d0af2017-10-20 16:06:08 -070021 done
22}
23
24# _build_vnfsdk_images() - Builds VNFSDK images from source code
25function _build_vnfsdk_images {
26 install_package unzip
27 pushd $vnfsdk_src_folder/refrepo/vnfmarket-be/deployment/docker/docker-refrepo
28 build_docker_image .
29 popd
30}
31
32# get_vnfsdk_images - Function that clones vnfsdk Docker images
33function get_vnfsdk_images {
34 if [[ "$build_image" == "True" ]]; then
35 # TODO(sshank): Has errors building.
36 _build_vnfsdk_images
37 else
38 pull_docker_image refrepo:1.0-STAGING-latest
39 pull_docker_image refrepo:latest
40 fi
41}
42
43# install_vnfsdk - Function that installs vnfsdk Docker images
44function install_vnfsdk {
45 install_docker_compose
46 pushd $vnfsdk_src_folder/refrepo/vnfmarket-be/deployment/install
47 /opt/docker/docker-compose up -d
48 popd
49}
50
51# init_vnfsdk() - Init VNFSDK services
52function init_vnfsdk {
53 if [[ "$clone_repo" == "True" ]]; then
54 clone_all_vnfsdk_repos
55 if [[ "$compile_repo" == "True" ]]; then
56 compile_all_vnfsdk_repos
57 fi
58 fi
59
60 if [[ "$skip_get_images" == "False" ]]; then
61 get_vnfsdk_images
62 if [[ "$skip_install" == "False" ]]; then
63 install_vnfsdk
64 fi
65 fi
66}