Skip to content

Commit 6181647

Browse files
committed
[FIX] runbot: force the start of all triggers for forwardports
1 parent 43be787 commit 6181647

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

runbot/models/batch.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ class Batch(models.Model):
1515

1616
last_update = fields.Datetime('Last ref update')
1717
bundle_id = fields.Many2one('runbot.bundle', required=True, index=True, ondelete='cascade')
18+
build_all = fields.Boolean('Force all triggers')
1819
commit_link_ids = fields.Many2many('runbot.commit.link')
1920
commit_ids = fields.Many2many('runbot.commit', compute='_compute_commit_ids')
2021
slot_ids = fields.One2many('runbot.batch.slot', 'batch_id')
@@ -187,6 +188,7 @@ def _prepare(self, auto_rebase=False, use_base_commits=False):
187188
priority_offset = self.bundle_id.priority_offset
188189
if not priority_offset and self.bundle_id.branch_ids.forwardport_of_id and self.bundle_id.last_batchs == self: # this is the only batch of a forwardported pr.
189190
priority_offset = - 3600 * 5
191+
self.build_all = True # for normal pr, mergebot will request all ci on r+ if needed, for forward port, we need to ensure they are all created or the chain could be blocked
190192
self.priority_level = int(self.create_date.timestamp() - priority_offset)
191193
if use_base_commits:
192194
self._warning('This batch will use base commits instead of bundle commits')
@@ -383,7 +385,7 @@ def _fill_missing(branch_commits, match_type):
383385
continue
384386
# in any case, search for an existing build
385387
config = trigger.config_id
386-
if not trigger_custom and trigger.light_config_id and not bundle.build_all and not bundle.is_staging and not bundle.is_base:
388+
if not trigger_custom and trigger.light_config_id and not bundle.build_all and not self.build_all and not bundle.is_staging and not bundle.is_base:
387389
if (project.use_light_default
388390
or
389391
project.use_light_draft and any(branch.draft for branch in self.bundle_id.branch_ids)
@@ -455,7 +457,10 @@ def _start_builds(self):
455457
is_dev = not bundle.is_staging and not bundle.is_base
456458
for trigger in self.slot_ids.trigger_id:
457459
enable_on_bundle = (trigger.on_staging and bundle.is_staging) or (trigger.on_base and bundle.is_base) or (trigger.on_dev and is_dev)
458-
if ((trigger.repo_ids & bundle_repos) or bundle.build_all or bundle.sticky) and enable_on_bundle:
460+
common_repo = (trigger.repo_ids & bundle_repos)
461+
if self.build_all and not common_repo:
462+
common_repo = (trigger.dependency_ids & bundle_repos)
463+
if (common_repo or bundle.build_all or bundle.sticky) and enable_on_bundle:
459464
should_start_triggers_ids.add(trigger.id)
460465

461466
disabled_triggers = self.bundle_id.all_trigger_custom_ids.filtered(lambda tc: tc.start_mode == 'disabled').trigger_id

0 commit comments

Comments
 (0)