Refactor bazel installation to go through a single script
Change-Id: I64bf55c4528ab98fbceec699e8b84350d5412c4c
diff --git a/jjb/onos/install-bazel.sh b/jjb/onos/install-bazel.sh
new file mode 100644
index 0000000..150a25d
--- /dev/null
+++ b/jjb/onos/install-bazel.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+# exit on errors
+set -eu -o pipefail
+
+BAZEL_VERSION="none"
+
+if [ ${GERRIT_BRANCH} == "onos-1.14" ]
+then
+ BAZEL_VERSION="0.15.2"
+fi
+if [ ${GERRIT_BRANCH} == "onos-1.15" -o ${GERRIT_BRANCH} == "master" -o ${GERRIT_BRANCH} == "upan-connect18" ]
+then
+ BAZEL_VERSION="0.19.0"
+fi
+
+if [ ${BAZEL_VERSION} != "none" ]
+then
+ echo Installing bazel version ${BAZEL_VERSION}
+ curl -L -o bazel.sh -s https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-installer-linux-x86_64.sh
+else
+ echo Not installing bazel
+fi
+
diff --git a/jjb/onos/onos-verify.yaml b/jjb/onos/onos-verify.yaml
index bec79ea..fb2e621 100644
--- a/jjb/onos/onos-verify.yaml
+++ b/jjb/onos/onos-verify.yaml
@@ -275,6 +275,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: onos-bazel-verify.sh
# JJB 1.6.2 does not support parameter expansion on filename?
#- shell: !include-raw-escape: {project-name}-verify.sh
@@ -518,6 +519,7 @@
variable: 'API_ONOSPROJECT_SSH_KEY'
#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: onos-bazel-release-build.sh
# JJB 1.6.2 does not support parameter expansion on filename?
#- shell: !include-raw-escape: {project-name}-verify.sh
@@ -608,6 +610,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: onos-run-bazel-stc.sh
@@ -632,6 +635,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: onos-run-bazel-stc-hag.sh