Commit c218b3d8 authored by Mattia Rizzolo's avatar Mattia Rizzolo

always set all the metadata on deployment failure

Signed-off-by: Mattia Rizzolo's avatarMattia Rizzolo <mattia@debian.org>
parent 1d9822b6
...@@ -246,7 +246,7 @@ class Branch: ...@@ -246,7 +246,7 @@ class Branch:
if not (branch / "build" / "managetests.json").exists(): if not (branch / "build" / "managetests.json").exists():
log("[!] No managetests.json found in the branch!") log("[!] No managetests.json found in the branch!")
log("[!] Aborting!") log("[!] Aborting!")
return False return self.fail_deployment(branch)
shutil.copy( shutil.copy(
str(branch / "build" / "managetests.json"), str(branch / "build" / "managetests.json"),
...@@ -259,7 +259,7 @@ class Branch: ...@@ -259,7 +259,7 @@ class Branch:
if not self.exec_command(cmd, build=True): if not self.exec_command(cmd, build=True):
log("[!] Failed to execute build command: %s" % " ".join(cmd)) log("[!] Failed to execute build command: %s" % " ".join(cmd))
log("[!] Aborting!") log("[!] Aborting!")
return False self.fail_deployment(branch)
# Check if the branch was successifully built # Check if the branch was successifully built
popen_args = self.command_popen_args(self.config["run"]) popen_args = self.command_popen_args(self.config["run"])
...@@ -268,7 +268,7 @@ class Branch: ...@@ -268,7 +268,7 @@ class Branch:
self.update_status("success") self.update_status("success")
else: else:
log("[!] Warning: build seems to have failed") log("[!] Warning: build seems to have failed")
self.update_status("failed") self.fail_deployment(branch)
self.manager.details["branches"][self.name] = self.mr self.manager.details["branches"][self.name] = self.mr
self.manager.save_details() self.manager.save_details()
...@@ -299,6 +299,15 @@ class Branch: ...@@ -299,6 +299,15 @@ class Branch:
pass pass
self.manager.save_details() self.manager.save_details()
def fail_deployment(self, branch):
self._deploying = False
self.update_status('failed')
self.manager.details["branches"][self.name] = self.mr
self.manager.save_details()
# Create the built file
(branch / "built").touch()
return False
def update_status(self, state, log=True): def update_status(self, state, log=True):
"""Update the commit status""" """Update the commit status"""
# Don't update status hooks on development instances # Don't update status hooks on development instances
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment