start refactoring STC jobs to use common cell allocation script
Change-Id: Ia10ca38b17d9780d1807e016301e5656fe36aeab
diff --git a/jjb/onos/allocate-cell-and-build.sh b/jjb/onos/allocate-cell-and-build.sh
new file mode 100755
index 0000000..a86f26f
--- /dev/null
+++ b/jjb/onos/allocate-cell-and-build.sh
@@ -0,0 +1,32 @@
+# initialize build environment
+ONOS_ROOT=`pwd`
+. tools/build/envDefaults
+
+# initialize development environment
+export JAVA_HOME=
+. tools/dev/bash_profile
+
+PATH=$PATH:/home/jenkins/bin
+
+cell_name="${BUILD_TAG}"
+
+# always free the cell when exiting
+function cleanup {
+ cell return ${cell_name}
+}
+
+trap cleanup EXIT
+
+# grab a cell to run on
+cell borrow 120 3+1 ${cell_name}
+
+# build onos bits
+bazel build onos
+
+# set up STC parameters
+topo default
+export stcDumpLogs="true"
+export stcColor="false"
+export stcHaltOnError="false"
+export TERM="vt100"
+
diff --git a/jjb/onos/onos-run-bazel-stc-hag.sh b/jjb/onos/onos-run-bazel-stc-hag.sh
index 6b07d13..6d26527 100644
--- a/jjb/onos/onos-run-bazel-stc-hag.sh
+++ b/jjb/onos/onos-run-bazel-stc-hag.sh
@@ -1,37 +1,4 @@
#!/bin/bash
-# exit on errors
-set -eu -o pipefail
-
-# initialize build environment
-ONOS_ROOT=`pwd`
-. tools/build/envDefaults
-
-# initialize development environment for STC
-export JAVA_HOME=
-. tools/dev/bash_profile
-
-PATH=$PATH:/home/jenkins/bin
-
-# always free the cell when exiting
-function cleanup {
- cell return jenkins-${ONOS_VERSION}
-}
-
-trap cleanup EXIT
-
-# grab a cell to run on
-cell borrow 30 3+1 jenkins-${ONOS_VERSION}
-
-# build onos bits
-bazel build onos
-
-# set up STC parameters
-topo default
-export stcDumpLogs="true"
-export stcColor="false"
-export stcHaltOnError="false"
-export TERM="vt100"
-
# run STC
stc setup && stc net-trellis-hag-smoke
diff --git a/jjb/onos/onos-verify.yaml b/jjb/onos/onos-verify.yaml
index 88fa068..3c1583a 100644
--- a/jjb/onos/onos-verify.yaml
+++ b/jjb/onos/onos-verify.yaml
@@ -651,6 +651,7 @@
builders:
#put shell scripts in file then make sure shell check is installed on verify vms
- shell: !include-raw-escape: install-bazel.sh
+ - shell: !include-raw-escape: allocate-cell-and-build.sh
- shell: !include-raw-escape: onos-run-bazel-stc-hag.sh
- job-template: