mirror of
https://github.com/odoo/runbot.git
synced 2025-03-15 23:45:44 +07:00
[IMP] runbot: parse log redirects to the created error
When builds logs are parsed by using the contextual button, the client stays on the same page even if a build error is created. With this commit, the client is now redirected to the created/found build error(s).
This commit is contained in:
parent
e51a27bbbb
commit
c6a1d202a1
@ -6,7 +6,7 @@
|
||||
<field name="type">ir.actions.server</field>
|
||||
<field name="state">code</field>
|
||||
<field name="code">
|
||||
records._parse_logs()
|
||||
action = records._parse_logs()
|
||||
</field>
|
||||
</record>
|
||||
<record model="ir.actions.server" id="action_parse_log">
|
||||
@ -16,7 +16,7 @@
|
||||
<field name="type">ir.actions.server</field>
|
||||
<field name="state">code</field>
|
||||
<field name="code">
|
||||
records._parse_logs()
|
||||
action = records._parse_logs()
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
|
@ -1022,7 +1022,7 @@ class BuildResult(models.Model):
|
||||
# only parse logs from builds in error and not already scanned
|
||||
builds_to_scan = self.search([('id', 'in', self.ids), ('local_result', '=', 'ko'), ('build_error_ids', '=', False)])
|
||||
ir_logs = self.env['ir.logging'].search([('level', '=', 'ERROR'), ('type', '=', 'server'), ('build_id', 'in', builds_to_scan.ids)])
|
||||
BuildError._parse_logs(ir_logs)
|
||||
return BuildError._parse_logs(ir_logs)
|
||||
|
||||
def is_file(self, file, mode='r'):
|
||||
file_path = self._path(file)
|
||||
|
@ -129,21 +129,36 @@ class BuildError(models.Model):
|
||||
fingerprint = self._digest(cleaning_regs.r_sub('%', log.message))
|
||||
hash_dict[fingerprint].append(log)
|
||||
|
||||
build_errors = self.env['runbot.build.error']
|
||||
# add build ids to already detected errors
|
||||
for build_error in self.env['runbot.build.error'].search([('fingerprint', 'in', list(hash_dict.keys())), ('active', '=', True)]):
|
||||
existing_errors = self.env['runbot.build.error'].search([('fingerprint', 'in', list(hash_dict.keys())), ('active', '=', True)])
|
||||
build_errors |= existing_errors
|
||||
for build_error in existing_errors:
|
||||
for build in {rec.build_id for rec in hash_dict[build_error.fingerprint]}:
|
||||
build.build_error_ids += build_error
|
||||
del hash_dict[build_error.fingerprint]
|
||||
|
||||
# create an error for the remaining entries
|
||||
for fingerprint, logs in hash_dict.items():
|
||||
build_error = self.env['runbot.build.error'].create({
|
||||
build_errors |= self.env['runbot.build.error'].create({
|
||||
'content': logs[0].message,
|
||||
'module_name': logs[0].name,
|
||||
'function': logs[0].func,
|
||||
'build_ids': [(6, False, [r.build_id.id for r in logs])],
|
||||
})
|
||||
|
||||
if build_errors:
|
||||
window_action = {
|
||||
"type": "ir.actions.act_window",
|
||||
"res_model": "runbot.build.error",
|
||||
"views": [[False, "tree"]],
|
||||
"domain": [('id', 'in', build_errors.ids)]
|
||||
}
|
||||
if len(build_errors) == 1:
|
||||
window_action["views"] = [[False, "form"]]
|
||||
window_action["res_id"] = build_errors.id
|
||||
return window_action
|
||||
|
||||
def link_errors(self):
|
||||
""" Link errors with the first one of the recordset
|
||||
choosing parent in error with responsible, random bug and finally fisrt seen
|
||||
|
@ -179,7 +179,7 @@ class RunbotErrorLog(models.Model):
|
||||
|
||||
def _parse_logs(self):
|
||||
BuildError = self.env['runbot.build.error']
|
||||
BuildError._parse_logs(self)
|
||||
return BuildError._parse_logs(self)
|
||||
|
||||
def init(self):
|
||||
""" Create an SQL view for ir.logging """
|
||||
|
Loading…
Reference in New Issue
Block a user