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:
if not (branch / "build" / "managetests.json").exists():
log("[!] No managetests.json found in the branch!")
log("[!] Aborting!")
return False
return self.fail_deployment(branch)
shutil.copy(
str(branch / "build" / "managetests.json"),
......@@ -259,7 +259,7 @@ class Branch:
if not self.exec_command(cmd, build=True):
log("[!] Failed to execute build command: %s" % " ".join(cmd))
log("[!] Aborting!")
return False
self.fail_deployment(branch)
# Check if the branch was successifully built
popen_args = self.command_popen_args(self.config["run"])
......@@ -268,7 +268,7 @@ class Branch:
self.update_status("success")
else:
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.save_details()
......@@ -299,6 +299,15 @@ class Branch:
pass
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):
"""Update the commit status"""
# 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