diff --git a/tools/bazel.rc b/tools/bazel.rc index 942b60e4fea..75a93323f7c 100644 --- a/tools/bazel.rc +++ b/tools/bazel.rc @@ -1,7 +1,7 @@ # Copied from https://github.com/envoyproxy/envoy/blob/master/tools/bazel.rc # Envoy specific Bazel build/test options. -#build --workspace_status_command=bazel/get_workspace_status +build --workspace_status_command=tools/bazel_get_workspace_status # Basic ASAN/UBSAN that works for gcc build:asan --define ENVOY_CONFIG_ASAN=1 diff --git a/tools/bazel.rc.ci b/tools/bazel.rc.ci index 664f7b13380..17706098cc5 100644 --- a/tools/bazel.rc.ci +++ b/tools/bazel.rc.ci @@ -1,3 +1,5 @@ +build --workspace_status_command=tools/bazel_get_workspace_status + # This is from Bazel's former travis setup, to avoid blowing up the RAM usage. startup --host_jvm_args=-Xmx8192m startup --host_jvm_args=-Xms8192m diff --git a/tools/bazel.rc.cloudbuilder b/tools/bazel.rc.cloudbuilder index 664f7b13380..17706098cc5 100644 --- a/tools/bazel.rc.cloudbuilder +++ b/tools/bazel.rc.cloudbuilder @@ -1,3 +1,5 @@ +build --workspace_status_command=tools/bazel_get_workspace_status + # This is from Bazel's former travis setup, to avoid blowing up the RAM usage. startup --host_jvm_args=-Xmx8192m startup --host_jvm_args=-Xms8192m diff --git a/tools/bazel_get_workspace_status b/tools/bazel_get_workspace_status new file mode 100755 index 00000000000..86ecc60b8fd --- /dev/null +++ b/tools/bazel_get_workspace_status @@ -0,0 +1,29 @@ +#!/bin/bash +# +# Copyright 2016 Istio Authors. All Rights Reserved. +# +# 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. +# +################################################################################ + +if git rev-parse --verify --quiet HEAD >/dev/null; then + echo "BUILD_SCM_REVISION $(git rev-parse --verify HEAD)" +else + exit 1 +fi + +if git diff-index --quiet HEAD --; then + echo "BUILD_SCM_STATUS Clean" +else + echo "BUILD_SCM_STATUS Modified" +fi