From 330e1eac0bb23602acb95d3aae72c7e8b73f833e Mon Sep 17 00:00:00 2001 From: Xavier-Do Date: Mon, 8 May 2023 13:26:07 +0200 Subject: [PATCH] [FIX] runbot: fix stats.js --- runbot/models/build.py | 13 +++++++++++++ runbot/models/build_config.py | 5 +++++ runbot/views/config_views.xml | 2 ++ 3 files changed, 20 insertions(+) diff --git a/runbot/models/build.py b/runbot/models/build.py index 03372ee3..213a7b0f 100644 --- a/runbot/models/build.py +++ b/runbot/models/build.py @@ -805,6 +805,19 @@ class BuildResult(models.Model): next_index += 1 continue break + + if self.local_result == 'ko': + if self.active_step and self.active_step.break_after_if_ko: + self._log('break_on_ko', f'Build is in failure, stopping after {self.active_step.name}') + self.local_state = 'done' + self.active_step = False + return + if new_step.break_before_if_ko: + self._log('break_on_ko', f'Build is in failure, stopping before {new_step.name}') + self.local_state = 'done' + self.active_step = False + return + build.active_step = new_step.id build.local_state = new_step._step_state() diff --git a/runbot/models/build_config.py b/runbot/models/build_config.py index 64ce96ea..0a82042a 100644 --- a/runbot/models/build_config.py +++ b/runbot/models/build_config.py @@ -100,6 +100,7 @@ class ConfigStepUpgradeDb(models.Model): db_pattern = fields.Char('Db suffix pattern') min_target_version_id = fields.Many2one('runbot.version', "Minimal target version_id") + TYPES = [ ('install_odoo', 'Test odoo'), ('run_odoo', 'Run odoo'), @@ -110,6 +111,8 @@ TYPES = [ ('test_upgrade', 'Test Upgrade'), ('restore', 'Restore'), ] + + class ConfigStep(models.Model): _name = 'runbot.build.config.step' _description = "Config step" @@ -179,6 +182,8 @@ class ConfigStep(models.Model): commit_limit = fields.Integer('Commit limit', default=50) file_limit = fields.Integer('File limit', default=450) + break_before_if_ko = fields.Boolean('Break before this step if build is ko') + break_after_if_ko = fields.Boolean('Break after this step if build is ko') @api.constrains('python_code') def _check_python_code(self): diff --git a/runbot/views/config_views.xml b/runbot/views/config_views.xml index 05308eb5..342fd164 100644 --- a/runbot/views/config_views.xml +++ b/runbot/views/config_views.xml @@ -47,6 +47,8 @@ + +