mirror of
https://github.com/odoo/runbot.git
synced 2025-03-15 23:45:44 +07:00
[IMP] runbot_merge: send integratin failure comment via feedback queue
If a transient github failure makes the integration fail but also makes the following reset fail the entire staging process would be cancelled (and operations so far rollbacked) except for the failure comment which would be effected, as in odoo/odoo#26380. By pushing the comment to the feedback queue, if the reset fails the comment is rollbacked and "unqueued".
This commit is contained in:
parent
e468d7116e
commit
8a1b3466a7
@ -1313,7 +1313,11 @@ class Batch(models.Model):
|
||||
except (exceptions.MergeError, AssertionError) as e:
|
||||
_logger.exception("Failed to merge %s:%s into staging branch (error: %s)", pr.repository.name, pr.number, e)
|
||||
pr.state = 'error'
|
||||
gh.comment(pr.number, "Unable to stage PR (%s)" % e)
|
||||
self.env['runbot_merge.pull_requests.feedback'].create({
|
||||
'repository': pr.repository.id,
|
||||
'pull_request': pr.number,
|
||||
'message': "Unable to stage PR (%s)" % e,
|
||||
})
|
||||
|
||||
# reset the head which failed, as rebase() may have partially
|
||||
# updated it (despite later steps failing)
|
||||
|
@ -652,6 +652,8 @@ def test_rebase_failure(env, repo, users, remote_p):
|
||||
with mock.patch.object(GH, 'set_ref', autospec=True, side_effect=wrapper) as m:
|
||||
env['runbot_merge.project']._check_progress()
|
||||
|
||||
env['runbot_merge.project']._send_feedback()
|
||||
|
||||
assert pr_a.comments == [
|
||||
(users['reviewer'], 'hansen r+'),
|
||||
(users['user'], re_matches(r'^Unable to stage PR')),
|
||||
|
@ -188,7 +188,7 @@ def test_merge_fail(env, project, repo_a, repo_b, users):
|
||||
pr2a = make_pr(repo_a, 'A2', [{'b': 'ok'}], label='do-b-thing')
|
||||
pr2b = make_pr(repo_b, 'B2', [{'b': 'ok'}], label='do-b-thing')
|
||||
|
||||
env['runbot_merge.project']._check_progress()
|
||||
run_crons(env)
|
||||
|
||||
s2 = to_pr(env, pr2a) | to_pr(env, pr2b)
|
||||
st = env['runbot_merge.stagings'].search([])
|
||||
|
Loading…
Reference in New Issue
Block a user