Allow to pass reclass-system ref to AIO jobs

Add ability to deploy AIO env from selected reclass branch, commit ref
or tag.

Change-Id: Ibff2e9112bec3d14ac28335747ff34c6171e0486
Related-Prod: PROD-28721 (PROD:28721)
diff --git a/bootstrap.sh b/bootstrap.sh
index 5796c28..de9ddaf 100755
--- a/bootstrap.sh
+++ b/bootstrap.sh
@@ -10,7 +10,7 @@
 #       Its not intended to be used in PRODUCTION unless you know what you are doing.
 #       You have been warned!
 
-__ScriptVersion="2019.02.26"
+__ScriptVersion="2019.02.27"
 __ScriptName="bootstrap.sh"
 __ScriptFullName="$0"
 __ScriptArgs="$*"
@@ -57,6 +57,8 @@
 # reclass
 export RECLASS_ADDRESS=${RECLASS_ADDRESS:-https://github.com/salt-formulas/openstack-salt.git} # https/git
 export RECLASS_BRANCH=${RECLASS_BRANCH:-master}
+export RECLASS_SYSTEM_ADDRESS=${RECLASS_SYSTEM_ADDRESS:-http://gerrit.mcp.mirantis.com/salt-models/reclass-system}
+export RECLASS_SYSTEM_BRANCH=${RECLASS_SYSTEM_BRANCH:-}
 
 # formula
 export FORMULAS_BASE=${FORMULAS_BASE:-https://github.com/salt-formulas}
@@ -337,8 +339,17 @@
 
   cd ${RECLASS_ROOT}
   if [ ! -d ${RECLASS_ROOT}/classes/system/linux ]; then
-    # Possibly subrepo checkout needed
     git submodule update --init --recursive
+    if [ -n "${RECLASS_SYSTEM_BRANCH}" ]; then
+      pushd classes/system
+      git checkout master && git clean -fd
+      if echo ${RECLASS_SYSTEM_BRANCH} | egrep -q "^refs"; then
+        git fetch ${RECLASS_SYSTEM_ADDRESS} ${RECLASS_SYSTEM_BRANCH} && git checkout FETCH_HEAD
+      else
+        git checkout ${RECLASS_SYSTEM_BRANCH}
+      fi
+      popd
+    fi
   fi
 
   mkdir -vp ${RECLASS_ROOT}/nodes/_generated