Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions tools/bazel_get_workspace_status
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright 2016 Istio Authors. All Rights Reserved.
# Copyright 2020 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.
Expand All @@ -16,17 +16,23 @@
#
################################################################################

if git rev-parse --verify --quiet HEAD >/dev/null; then
echo "BUILD_SCM_REVISION $(git rev-parse --verify HEAD)"
else
exit 1
if [ -z "${BUILD_SCM_REVISION}" ]; then
if git rev-parse --verify --quiet HEAD >/dev/null; then
BUILD_SCM_REVISION="$(git rev-parse --verify HEAD)"
else
exit 1
fi
fi

if git diff-index --quiet HEAD; then
echo "BUILD_SCM_STATUS Clean"
else
echo "BUILD_SCM_STATUS Modified"
if [ -z "${BUILD_SCM_STATUS}" ]; then
if git diff-index --quiet HEAD; then
BUILD_SCM_STATUS="Clean"
else
BUILD_SCM_STATUS="Modified"
fi
fi

echo "BUILD_SCM_REVISION ${BUILD_SCM_REVISION}"
echo "BUILD_SCM_STATUS ${BUILD_SCM_STATUS}"
echo "BUILD_CONFIG ${BUILD_CONFIG:-default}"
echo "DOCKER_REPOSITORY ${DOCKER_REPOSITORY:-istio-testing/envoy}"