Allow lightweight to be built from tag/commit 97/6397/1 BUILD_v4.0.1_2
authorMichael Marchetti <mmarchetti@sandvine.com>
Thu, 2 Aug 2018 20:47:16 +0000 (22:47 +0200)
committerMichael Marchetti <mmarchetti@sandvine.com>
Thu, 2 Aug 2018 21:25:46 +0000 (23:25 +0200)
The installer did not allow for a commit (with -b <commit_id> option).

Change-Id: I6aa0adf45c2ae27a552d16b2d0184f82115ae87b
Signed-off-by: Michael Marchetti <mmarchetti@sandvine.com>
devops-stages/stage-archive.sh
installers/full_install_osm.sh

index 593860b..2cffdd1 100755 (executable)
@@ -20,7 +20,7 @@ DEB_INSTALL=debian/osm-$MDG_NAME.install
 export DEBEMAIL="mmarchetti@sandvine.com"
 export DEBFULLNAME="Michael Marchetti"
 
-PKG_VERSION=$(git describe --tags --abbrev=0)
+PKG_VERSION=$(git describe --match "v*" --tags --abbrev=0)
 PKG_VERSION_PREFIX=$(echo $PKG_VERSION | sed -e 's/v//g')
 PKG_VERSION_POST=$(git rev-list $PKG_VERSION..HEAD | wc -l)
 if [ "$PKG_VERSION_POST" -eq 0 ]; then
index ffd9799..93a1112 100755 (executable)
@@ -586,6 +586,11 @@ function install_juju() {
 
 function generate_docker_images() {
     echo "Pulling and generating docker images"
+    _build_from=$COMMIT_ID
+    [ -z "$_build_from" ] && _build_from="master"
+
+    echo "OSM Docker images generated from $_build_from"
+
     if [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q KAFKA ; then
         sg docker -c "docker pull wurstmeister/zookeeper" || FATAL "cannot get zookeeper docker image"
         sg docker -c "docker pull wurstmeister/kafka" || FATAL "cannot get kafka docker image"
@@ -998,20 +1003,6 @@ fi
 # if develop, we force master
 [ -z "$COMMIT_ID" ] && [ -n "$DEVELOP" ] && COMMIT_ID="master"
 
-# forcing source from master removed. Now only install from source when explicit
-# [ -n "$COMMIT_ID" ] && [ "$COMMIT_ID" == "master" ] && INSTALL_FROM_SOURCE="y"
-
-if [ -z "$OSM_DEVOPS" ]; then
-    if [ -n "$TEST_INSTALLER" ]; then
-        echo -e "\nUsing local devops repo for OSM installation"
-        TEMPDIR="$(dirname $(realpath $(dirname $0)))"
-    else
-        echo -e "\nCreating temporary dir for OSM installation"
-        TEMPDIR="$(mktemp -d -q --tmpdir "installosm.XXXXXX")"
-        trap 'rm -rf "$TEMPDIR"' EXIT
-    fi
-fi
-
 need_packages="git jq wget curl tar"
 echo -e "Checking required packages: $need_packages"
 dpkg -l $need_packages &>/dev/null \
@@ -1024,25 +1015,28 @@ dpkg -l $need_packages &>/dev/null \
   || FATAL "failed to install $need_packages"
 
 if [ -z "$OSM_DEVOPS" ]; then
-    if [ -z "$TEST_INSTALLER" ]; then
-        echo -e "\nCloning devops repo temporarily"
-        git clone https://osm.etsi.org/gerrit/osm/devops.git $TEMPDIR
-        RC_CLONE=$?
-    fi
+    if [ -n "$TEST_INSTALLER" ]; then
+        echo -e "\nUsing local devops repo for OSM installation"
+        OSM_DEVOPS="$(dirname $(realpath $(dirname $0)))"
+    else
+        echo -e "\nCreating temporary dir for OSM installation"
+        OSM_DEVOPS="$(mktemp -d -q --tmpdir "installosm.XXXXXX")"
+        trap 'rm -rf "$OSM_DEVOPS"' EXIT
+
+        git clone https://osm.etsi.org/gerrit/osm/devops.git $OSM_DEVOPS
+
+        if [ -z "$COMMIT_ID" ]; then
+            echo -e "\nGuessing the current stable release"
+            LATEST_STABLE_DEVOPS=`git -C $OSM_DEVOPS tag -l v[0-9].* | sort -V | tail -n1`
+            [ -z "$LATEST_STABLE_DEVOPS" ] && echo "Could not find the current latest stable release" && exit 0
 
-    echo -e "\nGuessing the current stable release"
-    LATEST_STABLE_DEVOPS=`git -C $TEMPDIR tag -l v[0-9].* | sort -V | tail -n1`
-    [ -z "$COMMIT_ID" ] && [ -z "$LATEST_STABLE_DEVOPS" ] && echo "Could not find the current latest stable release" && exit 0
-    echo "Latest tag in devops repo: $LATEST_STABLE_DEVOPS"
-    [ -z "$COMMIT_ID" ] && [ -n "$LATEST_STABLE_DEVOPS" ] && COMMIT_ID="tags/$LATEST_STABLE_DEVOPS"
-
-    if [ -n "$RELEASE_DAILY" ]; then
-        echo "Using master/HEAD devops"
-        git -C $TEMPDIR checkout master
-    elif [ -z "$TEST_INSTALLER" ]; then
-        git -C $TEMPDIR checkout tags/$LATEST_STABLE_DEVOPS
+            echo "Latest tag in devops repo: $LATEST_STABLE_DEVOPS"
+            COMMIT_ID="tags/$LATEST_STABLE_DEVOPS"
+        else
+            echo -e "\nDEVOPS Using commit $COMMIT_ID"
+        fi
+        git -C $OSM_DEVOPS checkout $COMMIT_ID
     fi
-    OSM_DEVOPS=$TEMPDIR
 fi
 
 OSM_JENKINS="$OSM_DEVOPS/jenkins"