Shashank Kumar Shankar | d52d0af | 2017-10-20 16:06:08 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | set -o xtrace |
| 4 | |
| 5 | source /var/onap/functions |
| 6 | |
| 7 | vnfsdk_src_folder=$git_src_folder/vnfsdk |
Victor Morales | 6d280a1 | 2017-10-23 11:56:43 -0700 | [diff] [blame] | 8 | vnfsdk_repos=("vnfsdk/compliance" "vnfsdk/functest" "vnfsdk/lctest" "vnfsdk/model" "vnfsdk/pkgtools" "vnfsdk/refrepo" "vnfsdk/validation") |
Shashank Kumar Shankar | d52d0af | 2017-10-20 16:06:08 -0700 | [diff] [blame] | 9 | |
| 10 | # clone_all_vnfsdk_repos() - Function that clones vnfsdk source repo. |
| 11 | function clone_all_vnfsdk_repos { |
Victor Morales | 6d280a1 | 2017-10-23 11:56:43 -0700 | [diff] [blame] | 12 | for repo in ${vnfsdk_repos[@]}; do |
| 13 | clone_repo $repo $vnfsdk_src_folder${repo#*vnfsdk} |
Shashank Kumar Shankar | d52d0af | 2017-10-20 16:06:08 -0700 | [diff] [blame] | 14 | done |
| 15 | } |
| 16 | |
| 17 | # compile_all_vnfsdk_repos - Function that builds vnfsdk source repo |
| 18 | function compile_all_vnfsdk_repos { |
Victor Morales | 6d280a1 | 2017-10-23 11:56:43 -0700 | [diff] [blame] | 19 | for repo in ${vnfsdk_repos[@]}; do |
| 20 | compile_src $vnfsdk_src_folder${repo#*vnfsdk} |
Shashank Kumar Shankar | d52d0af | 2017-10-20 16:06:08 -0700 | [diff] [blame] | 21 | done |
| 22 | } |
| 23 | |
| 24 | # _build_vnfsdk_images() - Builds VNFSDK images from source code |
| 25 | function _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 |
| 33 | function 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 |
| 44 | function 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 |
| 52 | function 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 | } |