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 |
| 8 | |
| 9 | vnfsdk_repos=("refrepo") |
| 10 | |
| 11 | # clone_all_vnfsdk_repos() - Function that clones vnfsdk source repo. |
| 12 | function 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 |
| 20 | function 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 |
| 28 | function _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 |
| 36 | function 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 |
| 47 | function 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 |
| 55 | function 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 | } |