[IMP] runbot_merge: set status on skipchecks & use that

- rather than enumerate states, forward-porting should just check if
  the statuses are successful on a PR
- for the same consistency reasons explained in
  f97502e503, `skipchecks` should force
  the status of a PR to `success`: it very odd that a PR would be
  ready without being validated...
This commit is contained in:
Xavier Morel 2024-09-16 12:49:23 +02:00
parent fe7cd8e1f0
commit 851656bec0
3 changed files with 6 additions and 3 deletions

View File

@ -432,7 +432,7 @@ class Batch(models.Model):
_logger.info('-> no parent %s (%s)', batch, prs)
continue
if not force_fw and batch.source.fw_policy != 'skipci' \
and (invalid := batch.prs.filtered(lambda p: p.state not in ['validated', 'ready'])):
and (invalid := batch.prs.filtered(lambda p: p.status != 'success')):
_logger.info(
'-> wrong state %s (%s)',
batch,

View File

@ -1163,7 +1163,7 @@ For your own safety I've ignored *everything in your entire comment*.
super().modified(fnames, create, before)
@api.depends(
'statuses', 'overrides', 'target', 'parent_id',
'statuses', 'overrides', 'target', 'parent_id', 'skipchecks',
'repository.status_ids.context',
'repository.status_ids.branch_filter',
'repository.status_ids.prs',
@ -1173,6 +1173,9 @@ For your own safety I've ignored *everything in your entire comment*.
statuses = {**json.loads(pr.statuses), **pr._get_overrides()}
pr.statuses_full = json.dumps(statuses, indent=4)
if pr.skipchecks:
pr.status = 'success'
continue
st = 'success'
for ci in pr.repository.status_ids._for_pr(pr):

View File

@ -260,7 +260,7 @@ def test_force_ready(env, repo, config):
pr_id.skipchecks = True
assert pr_id.state == 'ready'
assert pr_id.status == 'pending'
assert pr_id.status == 'success'
reviewer = env['res.users'].browse([env._uid]).partner_id
assert pr_id.reviewed_by == reviewer