Skip to content
Open

[wip] #1168

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions runbot/models/branch.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ class Branch(models.Model):

alive = fields.Boolean('Alive', default=True)
draft = fields.Boolean('Draft', store=True)
close_date = fields.Datetime('Close date')
# merged_commit_id = fields.Many2one('runbot.commit', 'Merged commit', index=True) # TODO populate me

@api.depends('name', 'remote_id.short_name')
def _compute_dname(self):
Expand Down Expand Up @@ -241,9 +243,11 @@ def _recompute_infos(self, payload=None):
self._update_bundle_id()
return

if was_alive and not self.alive and self.bundle_id.for_next_freeze:
if not any(branch.alive and branch.is_pr for branch in self.bundle_id.branch_ids):
self.bundle_id.for_next_freeze = False
if was_alive and not self.alive:
self.close_date = self.env.cr.now()
if self.bundle_id.for_next_freeze:
if not any(branch.alive and branch.is_pr for branch in self.bundle_id.branch_ids):
self.bundle_id.for_next_freeze = False

if (not self.draft and was_draft) or (self.alive and not was_alive) or (self.target_branch_name != init_target_branch_name and self.alive):
self.bundle_id._force()
Expand Down
18 changes: 18 additions & 0 deletions runbot/models/build_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,16 @@ class BuildError(models.Model):
fixing_pr_id = fields.Many2one('runbot.branch', 'Fixing PR', tracking=True, domain=[('is_pr', '=', True)])
fixing_pr_alive = fields.Boolean('Fixing PR alive', related='fixing_pr_id.alive')
fixing_pr_url = fields.Char('Fixing PR url', related='fixing_pr_id.branch_url')
fixing_bundle_id = fields.Many2one('runbot.bundle', 'Fixing bundle', compute='_compute_fixing_bundle_id', store=True, tracking=True)
fixing_bundle_url = fields.Char('Fixing bundle url', related='fixing_bundle_id.frontend_url')

fixing_date = fields.Datetime('Fixing date', related="fixing_pr_id.close_date", help="Date of the merge of the first pr")
fixing_date_forwardports = fields.Datetime('Fixing date forwardports', help="Date of the merge of the last forwardport")
fixing_pr_ids = fields.Many2many('runbot.branch')
fixing_forwardport_date = fields.Datetime('Fixing forwardport date', help="Date when the PR was forwardported to the main branch")

breaking_bundle_id = fields.Many2one('runbot.bundle', 'Breaking bundle', tracking=True, help="Bundle that introduced the error")
breaking_bundle_url = fields.Char('Breaking bundle url', related='fixing_bundle_id.frontend_url')

test_tags = fields.Char(string='Test tags', help="Comma separated list of test_tags to use to reproduce/remove this error", tracking=True)
canonical_tags = fields.Char('Canonical tag', compute='_compute_canonical_tags', store=True)
Expand Down Expand Up @@ -244,6 +254,14 @@ def _inverse_tags_min_version_id(self):
if records.tags_min_version_id:
records.tags_min_version_excluded_id = next((version for version in all_versions if version.number < records.tags_min_version_id.number), False)

@api.depends('fixing_pr_id')
def _compute_fixing_bundle_id(self):
for record in self:
record.fixing_bundle_id = False
if record.fixing_pr_id:
record.fixing_bundle_id = record.fixing_pr_id.bundle_id


@api.depends('error_content_ids.canonical_tag')
def _compute_canonical_tags(self):
for record in self:
Expand Down
5 changes: 5 additions & 0 deletions runbot/models/bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,15 @@ class Bundle(models.Model):
commit_limit = fields.Integer("Commit limit")
file_limit = fields.Integer("File limit")
disable_codeowner = fields.Boolean("Disable codeowners", tracking=True)
frontend_url = fields.Char("Frontend URL", compute="_compute_frontend_url")

# extra_info
for_next_freeze = fields.Boolean('Should be in next freeze')

def _compute_frontend_url(self):
for bundle in self:
bundle.frontend_url = f'/runbot/bundle/{bundle.id}'

@api.depends('name')
def _compute_host_id(self):
assigned_only = None
Expand Down
1 change: 1 addition & 0 deletions runbot/views/build_error_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
</group>
<group>
<group name="fixer_info" string="Fixing" col="2">
<field name="breaking_bundle_id"/>
<field name="responsible"/>
<field name="customer"/>
<field name="team_id"/>
Expand Down