mirror of
https://github.com/odoo/runbot.git
synced 2025-03-15 23:45:44 +07:00
[IMP] runbot_merge: provide more useful message on some staging failures
If CI fails on a non-PR'd branch of a staging (e.g. given repos A and B and a PR to A, CI fails on the staging branch to B), the error message (log and comment on the PR) is unhelpful as it states that the staging failed for "unknown reason". Improve this by providing the failed CI context and the commit, which should allow finding out the branch & CI logs, and understanding the why of the failure. Fixes #36
This commit is contained in:
parent
e98a8caffb
commit
a0063f9df0
@ -871,7 +871,9 @@ class Stagings(models.Model):
|
||||
), None)
|
||||
if pr:
|
||||
self.fail(reason, pr)
|
||||
return False
|
||||
else:
|
||||
self.fail('%s failed on %s' % (reason, head))
|
||||
return False
|
||||
|
||||
# the staging failed but we don't have a specific culprit, fail
|
||||
# everything
|
||||
|
@ -266,6 +266,39 @@ def test_one_failed(env, project, repo_a, repo_b, owner):
|
||||
assert not pr_a.staging_id, \
|
||||
"pr_a should not have been staged as companion is not ready"
|
||||
|
||||
def test_other_failed(env, project, repo_a, repo_b, owner, users):
|
||||
""" In a non-matched-branch scenario, if the companion staging (copy of
|
||||
targets) fails when built with the PR, it should provide a non-useless
|
||||
message
|
||||
"""
|
||||
c_a = repo_a.make_commit(None, 'initial', None, tree={'a': 'a_0'})
|
||||
repo_a.make_ref('heads/master', c_a)
|
||||
# pr_a is born ready
|
||||
pr_a = make_pr(repo_a, 'A', [{'a': 'a_1'}], label='do-a-thing')
|
||||
repo_a.post_status(pr_a.head, 'success', 'ci/runbot')
|
||||
repo_a.post_status(pr_a.head, 'success', 'legal/cla')
|
||||
|
||||
c_b = repo_b.make_commit(None, 'initial', None, tree={'a': 'b_0'})
|
||||
repo_b.make_ref('heads/master', c_b)
|
||||
|
||||
env['runbot_merge.project']._check_progress()
|
||||
pr = to_pr(env, pr_a)
|
||||
assert pr.staging_id
|
||||
|
||||
repo_a.post_status('heads/staging.master', 'success', 'legal/cla')
|
||||
repo_a.post_status('heads/staging.master', 'success', 'ci/runbot')
|
||||
repo_b.post_status('heads/staging.master', 'success', 'legal/cla')
|
||||
repo_b.post_status('heads/staging.master', 'failure', 'ci/runbot')
|
||||
env['runbot_merge.project']._check_progress()
|
||||
|
||||
sth = repo_b.commit('heads/staging.master').id
|
||||
assert not pr.staging_id
|
||||
assert pr.state == 'error'
|
||||
assert pr_a.comments == [
|
||||
(users['reviewer'], 'hansen r+'),
|
||||
(users['user'], 'Staging failed: ci/runbot failed on %s' % sth)
|
||||
]
|
||||
|
||||
def test_batching(env, project, repo_a, repo_b):
|
||||
""" If multiple batches (label groups) are ready they should get batched
|
||||
together (within the limits of teh project's batch limit)
|
||||
|
Loading…
Reference in New Issue
Block a user