2021-02-28 13:24:16 +00:00
|
|
|
"""Helper script to get the actual branch name, docker safe"""
|
|
|
|
import os
|
2021-05-26 09:37:33 +01:00
|
|
|
from time import time
|
2021-02-28 13:24:16 +00:00
|
|
|
|
|
|
|
env_pr_branch = "SYSTEM_PULLREQUEST_SOURCEBRANCH"
|
|
|
|
default_branch = "BUILD_SOURCEBRANCHNAME"
|
|
|
|
|
|
|
|
branch_name = os.environ[default_branch]
|
|
|
|
if env_pr_branch in os.environ:
|
|
|
|
branch_name = os.environ[env_pr_branch].replace("/", "-")
|
|
|
|
|
|
|
|
print("##vso[task.setvariable variable=branchName]%s" % branch_name)
|
2021-05-26 09:37:33 +01:00
|
|
|
print("##vso[task.setvariable variable=timestamp]%s" % int(time()))
|