VCA start_build modified to take into account changes in juju client. OSM installer from source modified to check dependencies before installing
Change-Id: Ic7a6ef5d548a5d8cb0d09c405ba94a094c8c01f9
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
diff --git a/installers/install_from_source.sh b/installers/install_from_source.sh
index bb0ca7e..3a1c959 100755
--- a/installers/install_from_source.sh
+++ b/installers/install_from_source.sh
@@ -53,8 +53,13 @@
TEMPDIR="$(mktemp -d -q --tmpdir "installosm.XXXXXX")"
trap 'rm -rf "$TEMPDIR"' EXIT
+echo -e "Checking required packages: git"
+dpkg -l git &>/dev/null || ! echo -e " git not installed.\nInstalling git requires root privileges" || sudo apt install -y git
echo -e "\nCloning devops repo temporarily"
git clone https://osm.etsi.org/gerrit/osm/devops.git $TEMPDIR
+#DEVOPS_COMMITID="tags/v1.0.0"
+DEVOPS_COMMITID="master"
+git -C $TEMPDIR checkout $DEVOPS_COMMITID
RC_CLONE=$?
OSM_DEVOPS=$TEMPDIR
OSM_JENKINS="$TEMPDIR/jenkins"
@@ -75,6 +80,9 @@
fi
if [ -n "$NAT" ]; then
+ echo -e "\nChecking required packages: iptables-persistent"
+ dpkg -l iptables-persistent &>/dev/null || ! echo -e " Not installed.\nInstalling iptables-persistent requires root privileges" || \
+ sudo DEBIAN_FRONTEND=noninteractive apt-get -yq install iptables-persistent
sudo $OSM_DEVOPS/installers/nat_osm
exit 0
fi
@@ -82,12 +90,11 @@
#Installation starts here
wget -q -O- https://osm-download.etsi.org/ftp/osm-1.0-one/README.txt &> /dev/null
-echo -e "\nInstalling required packages: git, wget, curl, tar"
-echo -e " Required root privileges"
-sudo apt install -y git wget curl tar
+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 ..."
-COMMIT_ID="tags/v1.0"
+COMMIT_ID="tags/v1.0.0"
#COMMIT_ID="master"
[ -n "$DEVELOP" ] && COMMIT_ID="master"
$OSM_DEVOPS/jenkins/host/start_build RO checkout $COMMIT_ID
@@ -96,8 +103,8 @@
$OSM_DEVOPS/jenkins/host/start_build UI checkout $COMMIT_ID
#Install iptables-persistent
-echo -e "\nInstalling iptables-persistent"
-echo -e " Required root privileges"
+echo -e "\nChecking required packages: iptables-persistent"
+dpkg -l iptables-persistent &>/dev/null || ! echo -e " Not installed.\nInstalling iptables-persistent requires root privileges" || \
sudo DEBIAN_FRONTEND=noninteractive apt-get -yq install iptables-persistent
#Configure NAT rules
diff --git a/jenkins/VCA/start_build b/jenkins/VCA/start_build
index 5830d0e..1724d8e 100755
--- a/jenkins/VCA/start_build
+++ b/jenkins/VCA/start_build
@@ -51,7 +51,7 @@
add-apt-repository -y ppa:juju/devel
apt update
apt install -y juju
-juju bootstrap juju localhost
+juju bootstrap localhost osm
RC=0