blob: b73e064263e8c0ef5e2b2b7b8183568947b058cc [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
8
9vnfsdk_repos=("refrepo")
10
11# clone_all_vnfsdk_repos() - Function that clones vnfsdk source repo.
12function clone_all_vnfsdk_repos {
13
14 for dirc in ${vnfsdk_repos[@]}; do
15 clone_repo vnfsdk/$dirc $vnfsdk_src_folder/$dirc
16 done
17}
18
19# compile_all_vnfsdk_repos - Function that builds vnfsdk source repo
20function compile_all_vnfsdk_repos {
21
22 for dirc in ${vnfsdk_repos[@]}; do
23 clone_repo vnfsdk/$dirc $vnfsdk_src_folder/$dirc
24 done
25}
26
27# _build_vnfsdk_images() - Builds VNFSDK images from source code
28function _build_vnfsdk_images {
29 install_package unzip
30 pushd $vnfsdk_src_folder/refrepo/vnfmarket-be/deployment/docker/docker-refrepo
31 build_docker_image .
32 popd
33}
34
35# get_vnfsdk_images - Function that clones vnfsdk Docker images
36function get_vnfsdk_images {
37 if [[ "$build_image" == "True" ]]; then
38 # TODO(sshank): Has errors building.
39 _build_vnfsdk_images
40 else
41 pull_docker_image refrepo:1.0-STAGING-latest
42 pull_docker_image refrepo:latest
43 fi
44}
45
46# install_vnfsdk - Function that installs vnfsdk Docker images
47function install_vnfsdk {
48 install_docker_compose
49 pushd $vnfsdk_src_folder/refrepo/vnfmarket-be/deployment/install
50 /opt/docker/docker-compose up -d
51 popd
52}
53
54# init_vnfsdk() - Init VNFSDK services
55function init_vnfsdk {
56 if [[ "$clone_repo" == "True" ]]; then
57 clone_all_vnfsdk_repos
58 if [[ "$compile_repo" == "True" ]]; then
59 compile_all_vnfsdk_repos
60 fi
61 fi
62
63 if [[ "$skip_get_images" == "False" ]]; then
64 get_vnfsdk_images
65 if [[ "$skip_install" == "False" ]]; then
66 install_vnfsdk
67 fi
68 fi
69}