summaryrefslogtreecommitdiffstats
path: root/bootstrap/vagrant-onap/lib
diff options
context:
space:
mode:
authorGary Wu <gary.i.wu@huawei.com>2017-08-30 18:47:12 +0000
committerGerrit Code Review <gerrit@onap.org>2017-08-30 18:47:12 +0000
commitd353af8be5100d2ff55d0082f72d760ceb68b521 (patch)
treed929887e7175a5a13fdfca05757afc4ef6adea4e /bootstrap/vagrant-onap/lib
parent6811ec2e8d1269d67e78873c203d1d435e99ff34 (diff)
parent9911e6810d1e419be93aca41f7de937c7b2c817b (diff)
Merge "Add UTs for Portal script"
Diffstat (limited to 'bootstrap/vagrant-onap/lib')
-rwxr-xr-xbootstrap/vagrant-onap/lib/portal96
1 files changed, 62 insertions, 34 deletions
diff --git a/bootstrap/vagrant-onap/lib/portal b/bootstrap/vagrant-onap/lib/portal
index 44cedb20d..505bdde0c 100755
--- a/bootstrap/vagrant-onap/lib/portal
+++ b/bootstrap/vagrant-onap/lib/portal
@@ -3,53 +3,74 @@
set -o xtrace
source /var/onap/functions
-source /var/onap/asserts
-# install_mariadb() - Pull and create a MariaDB container
-function install_mariadb {
+policy_src_folder=$git_src_folder/portal
+policy_repos=("sdk")
+
+# clone_all_portal_repos() - Function that clones Portal source repo.
+function clone_all_portal_repos {
+ clone_repo portal $policy_src_folder
+ clone_repo ecompsdkos $policy_src_folder/ecompsdkos
+ clone_repo "ui/dmaapbc" $policy_src_folder/dmaapbc
+
+ for dirc in ${policy_repos[@]}; do
+ clone_repo portal/$dirc $policy_src_folder/$dirc
+ done
+}
+
+# compile_all_portal_repos() - Function that compiles Portal source repo.
+function compile_all_portal_repos {
+ compile_src $policy_src_folder
+
+ for dirc in ${policy_repos[@]}; do
+ compile_src $policy_src_folder/$dirc
+ done
+}
+
+# _build_portal_images() - Function that builds Portal Docker images from source code
+function _build_portal_images {
+ install_maven
+
+ pushd $policy_src_folder/deliveries
+ chmod +x *.sh
+ export MVN=$(which mvn)
+ export GLOBAL_SETTINGS_FILE=/usr/share/maven3/conf/settings.xml
+ export SETTINGS_FILE=$HOME/.m2/settings.xml
+ bash build_portalapps_dockers.sh
+ compile_src $policy_src_folder/ecomp-portal-widget-ms
+ build_docker_image $policy_src_folder/ecomp-portal-widget-ms
+ popd
+}
+
+# get_portal_images() - Function to get Portal images.
+function get_portal_images {
+ if [[ "$build_image" == "True" ]]; then
+ _build_portal_images
+ else
+ pull_openecomp_image portaldb ecompdb:portal
+ pull_openecomp_image portalapps ep:1610-1
+ fi
pull_docker_image mariadb
+}
+
+# _install_mariadb() - Pull and create a MariaDB container
+function _install_mariadb {
docker create --name data_vol_portal -v /var/lib/mysql mariadb
}
-# install_portal() - Function that pulls and install the source code of Portal
+# install_portal() - Function that installs the source code of Portal
function install_portal {
- local src_folder=/opt/portal
- clone_repo portal $src_folder
- clone_repo portal/sdk $src_folder/sdk
install_docker
docker rm -f ecompdb_portal
docker rm -f 1610-1
- pushd $src_folder/deliveries
- if [[ "$build_image" == "True" ]]; then
- install_maven
-
- clone_repo ecompsdkos $src_folder/ecompsdkos
- clone_repo "ui/dmaapbc" $src_folder/dmaapbc
- chmod +x *.sh
- export MVN=$(which mvn)
- export GLOBAL_SETTINGS_FILE=/usr/share/maven3/conf/settings.xml
- export SETTINGS_FILE=$HOME/.m2/settings.xml
- bash run.sh
- compile_src $src_folder/ecomp-portal-widget-ms
- build_docker_image $src_folder/ecomp-portal-widget-ms
- else
- pull_openecomp_image portaldb ecompdb:portal
- pull_openecomp_image portalapps ep:1610-1
- fi
- for image in ecompdb:portal ep:1610-1; do
- asserts_image $image
- done
-
- chmod +x new_start.sh
- chmod +x new_stop.sh
- chmod +x dbstart.sh
+ pushd $policy_src_folder/deliveries
mkdir -p /PROJECT/OpenSource/UbuntuEP/logs
install_package unzip
unzip -o etc.zip -d /PROJECT/OpenSource/UbuntuEP/
- bash dbstart.sh
- bash new_start.sh
+ install_docker_compose
+ bash portal_vm_init.sh
sleep 180
@@ -63,6 +84,13 @@ function install_portal {
# init_portal() - Function that initialize Portal services
function init_portal {
- install_mariadb
+ if [[ "$clone_repo" == "True" ]]; then
+ clone_all_portal_repos
+ if [[ "$compile_repo" == "True" ]]; then
+ compile_all_portal_repos
+ fi
+ fi
+ get_portal_images
+ _install_mariadb
install_portal
}