summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2019-02-04 21:18:43 +0000
committerGerrit Code Review <review@openstack.org>2019-02-04 21:18:43 +0000
commit6ea6885e2100943506e4024650c6f54c17732fa5 (patch)
tree4d63813f1cf446d53fe78772bc6663b533e2528c
parentf698238271076e4c82d7f4911560b11169e705e9 (diff)
parent393d66b04d0ec014096ef314ef94ec96897bb0aa (diff)
Merge "Fix stuck job caused by exception during repo update"
-rw-r--r--zuul/executor/server.py39
1 files changed, 26 insertions, 13 deletions
diff --git a/zuul/executor/server.py b/zuul/executor/server.py
index 43cc77a..ff3189f 100644
--- a/zuul/executor/server.py
+++ b/zuul/executor/server.py
@@ -495,6 +495,7 @@ class UpdateTask(object):
495 self.branches = None 495 self.branches = None
496 self.refs = None 496 self.refs = None
497 self.event = threading.Event() 497 self.event = threading.Event()
498 self.success = False
498 499
499 def __eq__(self, other): 500 def __eq__(self, other):
500 if (other and other.connection_name == self.connection_name and 501 if (other and other.connection_name == self.connection_name and
@@ -807,6 +808,11 @@ class AnsibleJob(object):
807 808
808 for task in tasks: 809 for task in tasks:
809 task.wait() 810 task.wait()
811
812 if not task.success:
813 raise ExecutorError(
814 'Failed to update project %s' % task.canonical_name)
815
810 self.project_info[task.canonical_name] = { 816 self.project_info[task.canonical_name] = {
811 'refs': task.refs, 817 'refs': task.refs,
812 'branches': task.branches, 818 'branches': task.branches,
@@ -2414,19 +2420,26 @@ class ExecutorServer(object):
2414 if task is None: 2420 if task is None:
2415 # We are asked to stop 2421 # We are asked to stop
2416 raise StopException() 2422 raise StopException()
2417 with self.merger_lock: 2423 try:
2418 self.log.info("Updating repo %s/%s" % ( 2424 with self.merger_lock:
2419 task.connection_name, task.project_name)) 2425 self.log.info("Updating repo %s/%s",
2420 self.merger.updateRepo(task.connection_name, task.project_name) 2426 task.connection_name, task.project_name)
2421 repo = self.merger.getRepo(task.connection_name, task.project_name) 2427 self.merger.updateRepo(task.connection_name, task.project_name)
2422 source = self.connections.getSource(task.connection_name) 2428 repo = self.merger.getRepo(
2423 project = source.getProject(task.project_name) 2429 task.connection_name, task.project_name)
2424 task.canonical_name = project.canonical_name 2430 source = self.connections.getSource(task.connection_name)
2425 task.branches = repo.getBranches() 2431 project = source.getProject(task.project_name)
2426 task.refs = [r.name for r in repo.getRefs()] 2432 task.canonical_name = project.canonical_name
2427 self.log.debug("Finished updating repo %s/%s" % 2433 task.branches = repo.getBranches()
2428 (task.connection_name, task.project_name)) 2434 task.refs = [r.name for r in repo.getRefs()]
2429 task.setComplete() 2435 self.log.debug("Finished updating repo %s/%s",
2436 task.connection_name, task.project_name)
2437 task.success = True
2438 except Exception:
2439 self.log.exception('Got exception while updating repo %s/%s',
2440 task.connection_name, task.project_name)
2441 finally:
2442 task.setComplete()
2430 2443
2431 def update(self, connection_name, project_name): 2444 def update(self, connection_name, project_name):
2432 # Update a repository in the main merger 2445 # Update a repository in the main merger