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