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