Try and get a valid branch name on jenkins
This commit is contained in:
parent
16418dd7ad
commit
461173a778
1 changed files with 10 additions and 7 deletions
|
@ -47,13 +47,16 @@ def main():
|
|||
|
||||
(mcpversion,mcclientversion,mcserverversion) = re.match("[.\w]+ \(data: ([.\w]+), client: ([.\w.]+), server: ([.\w.]+)\)",Commands.fullversion()).groups()
|
||||
|
||||
cmd = "git rev-parse --abbrev-ref HEAD"
|
||||
try:
|
||||
process = subprocess.Popen(cmdsplit(cmd), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, bufsize=-1)
|
||||
branch, _ = process.communicate()
|
||||
except OSError:
|
||||
print("Git not found")
|
||||
branch="none"
|
||||
if os.getenv("GIT_BRANCH") is None:
|
||||
cmd = "git rev-parse --abbrev-ref HEAD"
|
||||
try:
|
||||
process = subprocess.Popen(cmdsplit(cmd), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, bufsize=-1)
|
||||
branch, _ = process.communicate()
|
||||
except OSError:
|
||||
print("Git not found")
|
||||
branch="none"
|
||||
else:
|
||||
branch=os.getenv("GIT_BRANCH")
|
||||
|
||||
with open("fmlversion.properties","w") as f:
|
||||
f.write("%s=%s\n" %("fmlbuild.major.number",major))
|
||||
|
|
Loading…
Reference in a new issue