Merge pull request #1426 from daleglass/remove-headsha

Don't retrieve repository's SHA in prebuild
This commit is contained in:
Dale Glass 2021-10-28 23:33:15 +02:00 committed by GitHub
commit 54db82b2b7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -58,22 +58,6 @@ class TrackableLogger(logging.Logger):
logging.setLoggerClass(TrackableLogger)
logger = logging.getLogger('prebuild')
def headSha():
if shutil.which('git') is None:
logger.warn("Unable to find git executable, can't caclulate commit ID")
return '0xDEADBEEF'
repo_dir = os.path.dirname(os.path.abspath(__file__))
git = subprocess.Popen(
'git rev-parse --short HEAD',
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
shell=True, cwd=repo_dir, universal_newlines=True,
)
stdout, _ = git.communicate()
sha = stdout.split('\n')[0]
if not sha:
raise RuntimeError("couldn't find git sha for repository {}".format(repo_dir))
return sha
@contextmanager
def timer(name):
''' Print the elapsed time a context's execution takes to execute '''
@ -120,7 +104,6 @@ def main():
if args.ci_build:
logging.basicConfig(datefmt='%H:%M:%S', format='%(asctime)s %(guid)s %(message)s', level=logging.INFO)
logger.info('sha=%s' % headSha())
logger.info('start')
# OS dependent information