mirror of
https://github.com/odoo/runbot.git
synced 2025-03-15 23:45:44 +07:00
[FIX] runbt: runbot build error parse_log fixes
This commit is contained in:
parent
c2e9aaf387
commit
7c5d61b252
@ -5,6 +5,11 @@ _logger = logging.getLogger(__name__)
|
||||
|
||||
def migrate(cr, version):
|
||||
|
||||
#cr.execute('CREATE SEQUENCE runbot_build_error_id_seq')
|
||||
# update sequence
|
||||
cr.execute("SELECT setval('runbot_build_error_id_seq', (SELECT MAX(id) FROM runbot_build_error))")
|
||||
cr.execute("ALTER TABLE runbot_build_error ALTER COLUMN id SET DEFAULT nextval('runbot_build_error_id_seq')")
|
||||
|
||||
# get seen infos
|
||||
cr.execute("SELECT error_content_id, min(build_id), min(log_date), max(build_id), max(log_date), count(DISTINCT build_id) FROM runbot_build_error_link GROUP BY error_content_id")
|
||||
vals_by_error = {error: vals for error, *vals in cr.fetchall()}
|
||||
|
@ -1,4 +1,7 @@
|
||||
def migrate(cr, version):
|
||||
cr.execute('ALTER TABLE runbot_build_error RENAME TO runbot_build_error_content')
|
||||
cr.execute('CREATE SEQUENCE runbot_build_error_content_id_seq')
|
||||
cr.execute("SELECT setval('runbot_build_error_content_id_seq', (SELECT MAX(id) FROM runbot_build_error_content))")
|
||||
cr.execute("ALTER TABLE runbot_build_error_content ALTER COLUMN id SET DEFAULT nextval('runbot_build_error_content_id_seq')")
|
||||
cr.execute('ALTER TABLE runbot_build_error_content ADD COLUMN first_seen_build_id INT')
|
||||
cr.execute('ALTER TABLE runbot_build_error_link RENAME COLUMN build_error_id TO error_content_id')
|
||||
|
@ -70,9 +70,11 @@ def _compute_related_error_content_ids(field_name):
|
||||
|
||||
class BuildError(models.Model):
|
||||
_name = "runbot.build.error"
|
||||
_description = "An object to manage a group of errors log that fit together and assign them to a team"
|
||||
_description = "Build error"
|
||||
# An object to manage a group of errors log that fit together and assign them to a team
|
||||
_inherit = ('mail.thread', 'mail.activity.mixin', 'runbot.build.error.seen.mixin')
|
||||
|
||||
|
||||
name = fields.Char("Name")
|
||||
active = fields.Boolean('Open (not fixed)', default=True, tracking=True)
|
||||
description = fields.Text("Description", store=True, compute='_compute_description')
|
||||
@ -320,7 +322,7 @@ class BuildError(models.Model):
|
||||
class BuildErrorContent(models.Model):
|
||||
|
||||
_name = 'runbot.build.error.content'
|
||||
_description = "Build error log"
|
||||
_description = "Build error content"
|
||||
|
||||
_inherit = ('mail.thread', 'mail.activity.mixin', 'runbot.build.error.seen.mixin')
|
||||
_rec_name = "id"
|
||||
@ -360,9 +362,10 @@ class BuildErrorContent(models.Model):
|
||||
previous_error_content = error_content.search([
|
||||
('fingerprint', '=', error_content.fingerprint),
|
||||
('error_id.active', '=', False),
|
||||
('error_id.id', '!=', error_content.error_id.id or False),
|
||||
('id', '!=', error_content.id or False),
|
||||
])
|
||||
if previous_error_content and previous_error_content != error_content.error_id:
|
||||
], order="id desc", limit=1)
|
||||
if previous_error_content:
|
||||
error_content.error_id.message_post(body=f"An historical error was found for error {error_content.id}: {previous_error_content.id}")
|
||||
error_content.error_id.previous_error_id = previous_error_content.error_id
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user