Adding check for Bazel version 0.15.*

Change-Id: I96da2721947a41c91dc5eac250b3016aa16a2fcb
diff --git a/WORKSPACE b/WORKSPACE
index 38c41b5..13a4ea7 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -1,5 +1,8 @@
 workspace(name = "org_onosproject_onos")
 
+load("//tools/build/bazel:bazel_version.bzl", "check_bazel_version")
+check_bazel_version()
+
 load("//tools/build/bazel:generate_workspace.bzl", "generated_maven_jars")
 generated_maven_jars()
 
diff --git a/tools/build/bazel/bazel_version.bzl b/tools/build/bazel/bazel_version.bzl
new file mode 100644
index 0000000..4aa4b1c
--- /dev/null
+++ b/tools/build/bazel/bazel_version.bzl
@@ -0,0 +1,26 @@
+"""
+ Copyright 2018-present Open Networking Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+"""
+
+def check_bazel_version():
+  if "bazel_version" not in dir(native):
+    fail("\nBazel version is too old; please use 0.15.* official release!\n\n")
+  elif not native.bazel_version:
+    print("\nBazel is not a release version; please use 0.15.* official release!\n\n")
+    return
+
+  if not native.bazel_version.startswith("0.15."):
+    fail("\nBazel version %s is not supported; please use 0.15.* official release!\n\n"
+            % native.bazel_version)