X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=installers%2Finstall_from_source.sh;h=5f483cd333f315cba0c77ae2221db5bba7aa2197;hb=d880f72e4633a496a14a7e9288855dd9a98a3f26;hp=fbf0f02150e3e272344fa157d25b7ee3fa8f6f9b;hpb=237cfd5ccce2da5eab0e5574ae899a4407215293;p=osm%2Fdevops.git diff --git a/installers/install_from_source.sh b/installers/install_from_source.sh index fbf0f021..5f483cd3 100755 --- a/installers/install_from_source.sh +++ b/installers/install_from_source.sh @@ -18,9 +18,10 @@ function usage(){ echo -e "Install OSM from source code" echo -e " OPTIONS" echo -e " --uninstall: uninstall OSM: remove the containers and delete NAT rules" - echo -e " -b : install OSM from source code using a specific branch (master, v1.0, ...)" + echo -e " -b : install OSM from source code using a specific branch (master, v1.0, ...) or tag" echo -e " -b master" echo -e " -b v1.0" + echo -e " -b tags/v1.1.0" echo -e " ..." echo -e " --develop: (deprecated, use '-b master') install OSM from source code using the master branch" echo -e " --nat: install only NAT rules" @@ -66,7 +67,7 @@ function update(){ lxc exec $CONTAINER -- git -C $INSTALL_FOLDER fetch --all BRANCH="" BRANCH=`lxc exec $CONTAINER -- git -C $INSTALL_FOLDER status -sb | head -n1 | sed -n 's/^## \(.*\).*/\1/p'|awk '{print $1}' |sed 's/\(.*\)\.\.\..*/\1/'` - [ -z "$BRANCH" ] && echo " Could not find the current branch in use in the $MDG" && exit 1 + [ -z "$BRANCH" ] && FATAL "Could not find the current branch in use in the '$MDG'" CURRENT=`lxc exec $CONTAINER -- git -C $INSTALL_FOLDER status |head -n1` CURRENT_COMMIT_ID=`lxc exec $CONTAINER -- git -C $INSTALL_FOLDER rev-parse HEAD` echo " FROM: $CURRENT ($CURRENT_COMMIT_ID)" @@ -102,7 +103,7 @@ function update(){ lxc exec $CONTAINER -- git -C $INSTALL_FOLDER fetch --all BRANCH="" BRANCH=`lxc exec $CONTAINER -- git -C $INSTALL_FOLDER status -sb | head -n1 | sed -n 's/^## \(.*\).*/\1/p'|awk '{print $1}' |sed 's/\(.*\)\.\.\..*/\1/'` - [ -z "$BRANCH" ] && echo " Could not find the current branch in use in the $MDG" && exit 1 + [ -z "$BRANCH" ] && FATAL "Could not find the current branch in use in the '$MDG'" CURRENT=`lxc exec $CONTAINER -- git -C $INSTALL_FOLDER status |head -n1` CURRENT_COMMIT_ID=`lxc exec $CONTAINER -- git -C $INSTALL_FOLDER rev-parse HEAD` echo " FROM: $CURRENT ($CURRENT_COMMIT_ID)" @@ -225,6 +226,19 @@ while getopts ":hy-:b:" o; do esac done +if [ -n "$SHOWOPTS" ]; then + echo "DEVELOP=$DEVELOP" + echo "UNINSTALL=$UNINSTALL" + echo "NAT=$NAT" + echo "UPDATE=$UPDATE" + echo "RECONFIGURE=$RECONFIGURE" + echo "TEST_INSTALLER=$TEST_INSTALLER" + echo "LXD=$LXD" + echo "SHOWOPTS=$SHOWOPTS" + echo "Install from specific refspec (-b): $COMMIT_ID" + exit 0 +fi + [ -z "$COMMIT_ID" ] && [ -n "$DEVELOP" ] && COMMIT_ID="master" [ -n "$TEST_INSTALLER" ] && [ -z "$COMMIT_ID" ] && echo "Use -b option to specify the branch to use for the test (e.g.: v1.0)" && exit 0 @@ -248,20 +262,10 @@ fi echo -e "\nGuessing the current stable release" LATEST_STABLE_DEVOPS=`git -C $TEMPDIR tag -l v[0-9].* | tail -n1` [ -z "$COMMIT_ID" ] && [ -z "$LATEST_STABLE_DEVOPS" ] && echo "Could not find the current latest stable release" && exit 0 - -if [ -n "$SHOWOPTS" ]; then - echo "DEVELOP=$DEVELOP" - echo "UNINSTALL=$UNINSTALL" - echo "NAT=$NAT" - echo "UPDATE=$UPDATE" - echo "RECONFIGURE=$RECONFIGURE" - echo "TEST_INSTALLER=$TEST_INSTALLER" - echo "LXD=$LXD" - echo "SHOWOPTS=$SHOWOPTS" - echo "Latest tag in devops repo: $LATEST_STABLE_DEVOPS" - echo "Commit to be installed (-b): $COMMIT_ID" - exit 0 -fi +echo "Latest tag in devops repo: $LATEST_STABLE_DEVOPS" +[ -z "$COMMIT_ID" ] && [ -n "$LATEST_STABLE_DEVOPS" ] && COMMIT_ID="tags/$LATEST_STABLE_DEVOPS" +[ -z "$TEST_INSTALLER" ] && git -C $TEMPDIR checkout $LATEST_STABLE_DEVOPS +echo -e "\n Installing OSM from refspec: $COMMIT_ID" OSM_DEVOPS=$TEMPDIR OSM_JENKINS="$TEMPDIR/jenkins" @@ -279,8 +283,8 @@ if [ -z "$ASSUME_YES" ]; then [ "$USER_CONFIRMATION" != "y" ] && echo "Cancelled!" && exit 0 fi -[ -z "$COMMIT_ID" ] && [ -n "$LATEST_STABLE_DEVOPS" ] && COMMIT_ID="tags/$LATEST_STABLE_DEVOPS" -echo -e "\n Installing OSM from refspec: $COMMIT_ID" +echo -e "Checking required packages: lxd" +lxd --version &>/dev/null || FATAL "lxd not present, exiting." wget -q -O- https://osm-download.etsi.org/ftp/osm-1.0-one/README.txt &> /dev/null @@ -290,10 +294,10 @@ echo -e "\nChecking required packages: wget, curl, tar" dpkg -l wget curl tar &>/dev/null || ! echo -e " One or several packages are not installed.\nInstalling required packages\n Root privileges are required" || sudo apt install -y wget curl tar echo -e "\nCreating the containers and building ..." -$OSM_DEVOPS/jenkins/host/start_build RO --notest checkout $COMMIT_ID -$OSM_DEVOPS/jenkins/host/start_build VCA -$OSM_DEVOPS/jenkins/host/start_build SO checkout $COMMIT_ID -$OSM_DEVOPS/jenkins/host/start_build UI checkout $COMMIT_ID +$OSM_DEVOPS/jenkins/host/start_build RO --notest checkout $COMMIT_ID || FATAL "RO container build failed (refspec: '$COMMIT_ID')" +$OSM_DEVOPS/jenkins/host/start_build VCA || FATAL "VCA container build failed" +$OSM_DEVOPS/jenkins/host/start_build SO checkout $COMMIT_ID || FATAL "SO container build failed (refspec: '$COMMIT_ID')" +$OSM_DEVOPS/jenkins/host/start_build UI checkout $COMMIT_ID || FATAL "UI container build failed (refspec: '$COMMIT_ID')" #Install iptables-persistent and configure NAT rules nat @@ -301,5 +305,5 @@ nat #Configure components configure -echo -e "\nDONE" wget -q -O- https://osm-download.etsi.org/ftp/osm-1.0-one/README2.txt &> /dev/null +echo -e "\nDONE"