blob: 9355c6c38de6d5f7d5ff7259fd3b8d0b41c9f777 [file] [log] [blame]
#!/usr/bin/env python
# This script will be run by bazel when the build process starts to
# generate key-value information that represents the status of the
# workspace. The output should be like
#
# KEY1 VALUE1
# KEY2 VALUE2
#
# If the script exits with non-zero code, it's considered as a failure
# and the output will be discarded.
from __future__ import print_function
import subprocess
import sys
CMD = ['git', 'describe', '--always', '--match', 'v[0-9].*', '--dirty']
def revision():
try:
return subprocess.check_output(CMD).strip().decode("utf-8")
except OSError as err:
print('could not invoke git: %s' % err, file=sys.stderr)
sys.exit(1)
except subprocess.CalledProcessError as err:
print('error using git: %s' % err, file=sys.stderr)
sys.exit(1)
print("STABLE_BUILD_GC-CONDUCTOR_LABEL %s" % revision())