[FIX] runbot_merge: don't blow the fetch loop when a PR has no label

No test because I don't understand how / why it's triggered, it's just
that some PRs don't have a label. I assumed the issue occurred when
the source branch or even repo (cross-repo PR) was deleted, but it
doesn't seem to trigger the issue (or in any case not in as short a
time as a test, maybe GH eventually does some vacuuming which causes
the issue?

Anyway we may eventually want to reclaim these PRs (allowing a lack of
label and treating them like the patch-\d labels: with no semantic
value) however the simplest thing to do for now is to just ignore the
corresponding PR.

closes #101
This commit is contained in:
Xavier Morel 2019-02-28 17:14:57 +01:00
parent 55ece42d8f
commit 0cd587fce7

View File

@ -148,7 +148,13 @@ class Project(models.Model):
if not f:
return
f.repository._load_pr(f.number)
self.env.cr.execute("SAVEPOINT runbot_merge_before_fetch")
try:
f.repository._load_pr(f.number)
except Exception:
self.env.cr.execute("ROLLBACK TO SAVEPOINT runbot_merge_before_fetch")
_logger.exception("Failed to load pr %s, skipping it", f.number)
self.env.cr.execute("RELEASE SAVEPOINT runbot_merge_before_fetch")
# commit after each fetched PR
f.active = False