mirror of
https://github.com/odoo/runbot.git
synced 2025-03-27 13:25:47 +07:00
[IMP] runbot: add an option on step to disable logdb
This commit is contained in:
parent
f6eb23f896
commit
5a5e7693d4
@ -1012,7 +1012,7 @@ class BuildResult(models.Model):
|
|||||||
_logger.error('None of %s found in commit, actual commit content:\n %s' % (commit.repo_id.server_files, os.listdir(commit._source_path())))
|
_logger.error('None of %s found in commit, actual commit content:\n %s' % (commit.repo_id.server_files, os.listdir(commit._source_path())))
|
||||||
raise RunbotException('No server found in %s' % commit.dname)
|
raise RunbotException('No server found in %s' % commit.dname)
|
||||||
|
|
||||||
def _cmd(self, python_params=None, py_version=None, local_only=True, sub_command=None):
|
def _cmd(self, python_params=None, py_version=None, local_only=True, sub_command=None, enable_log_db=True):
|
||||||
"""Return a list describing the command to start the build
|
"""Return a list describing the command to start the build
|
||||||
"""
|
"""
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
@ -1056,11 +1056,12 @@ class BuildResult(models.Model):
|
|||||||
elif grep(config_path, "--xmlrpc-interface"):
|
elif grep(config_path, "--xmlrpc-interface"):
|
||||||
command.add_config_tuple("xmlrpc_interface", "127.0.0.1")
|
command.add_config_tuple("xmlrpc_interface", "127.0.0.1")
|
||||||
|
|
||||||
log_db = self.env['ir.config_parameter'].get_param('runbot.logdb_name')
|
if enable_log_db:
|
||||||
if grep(config_path, "log-db"):
|
log_db = self.env['ir.config_parameter'].get_param('runbot.logdb_name')
|
||||||
command.add_config_tuple("log_db", log_db)
|
if grep(config_path, "log-db"):
|
||||||
if grep(config_path, 'log-db-level'):
|
command.add_config_tuple("log_db", log_db)
|
||||||
command.add_config_tuple("log_db_level", '25')
|
if grep(config_path, 'log-db-level'):
|
||||||
|
command.add_config_tuple("log_db_level", '25')
|
||||||
|
|
||||||
if grep(config_path, "data-dir"):
|
if grep(config_path, "data-dir"):
|
||||||
datadir = build._path('datadir')
|
datadir = build._path('datadir')
|
||||||
|
@ -163,6 +163,7 @@ class ConfigStep(models.Model):
|
|||||||
sub_command = fields.Char('Subcommand', tracking=True)
|
sub_command = fields.Char('Subcommand', tracking=True)
|
||||||
extra_params = fields.Char('Extra cmd args', tracking=True)
|
extra_params = fields.Char('Extra cmd args', tracking=True)
|
||||||
additionnal_env = fields.Char('Extra env', help='Example: foo="bar";bar="foo". Cannot contains \' ', tracking=True)
|
additionnal_env = fields.Char('Extra env', help='Example: foo="bar";bar="foo". Cannot contains \' ', tracking=True)
|
||||||
|
enable_log_db = fields.Boolean("Enable log db", default=True)
|
||||||
# python
|
# python
|
||||||
python_code = fields.Text('Python code', tracking=True, default=PYTHON_DEFAULT)
|
python_code = fields.Text('Python code', tracking=True, default=PYTHON_DEFAULT)
|
||||||
python_result_code = fields.Text('Python code for result', tracking=True, default=PYTHON_DEFAULT)
|
python_result_code = fields.Text('Python code for result', tracking=True, default=PYTHON_DEFAULT)
|
||||||
@ -357,10 +358,9 @@ class ConfigStep(models.Model):
|
|||||||
|
|
||||||
exports = build._checkout()
|
exports = build._checkout()
|
||||||
|
|
||||||
# adjust job_end to record an accurate job_20 job_time
|
|
||||||
build._log('run', 'Start running build %s' % build.dest)
|
build._log('run', 'Start running build %s' % build.dest)
|
||||||
# run server
|
# run server
|
||||||
cmd = build._cmd(local_only=False)
|
cmd = build._cmd(local_only=False, enable_log_db=self.enable_log_db)
|
||||||
|
|
||||||
available_options = build.parse_config()
|
available_options = build.parse_config()
|
||||||
|
|
||||||
@ -416,7 +416,7 @@ class ConfigStep(models.Model):
|
|||||||
python_params = ['-m', 'coverage', 'run', '--branch', '--source', '/data/build'] + coverage_extra_params
|
python_params = ['-m', 'coverage', 'run', '--branch', '--source', '/data/build'] + coverage_extra_params
|
||||||
elif self.flamegraph:
|
elif self.flamegraph:
|
||||||
python_params = ['-m', 'flamegraph', '-o', self._perfs_data_path()]
|
python_params = ['-m', 'flamegraph', '-o', self._perfs_data_path()]
|
||||||
cmd = build._cmd(python_params, py_version, sub_command=self.sub_command)
|
cmd = build._cmd(python_params, py_version, sub_command=self.sub_command, enable_log_db=self.enable_log_db)
|
||||||
# create db if needed
|
# create db if needed
|
||||||
db_suffix = build.params_id.config_data.get('db_name') or (build.params_id.dump_db.db_suffix if not self.create_db else False) or self.db_name
|
db_suffix = build.params_id.config_data.get('db_name') or (build.params_id.dump_db.db_suffix if not self.create_db else False) or self.db_name
|
||||||
db_name = '%s-%s' % (build.dest, db_suffix)
|
db_name = '%s-%s' % (build.dest, db_suffix)
|
||||||
@ -715,7 +715,7 @@ class ConfigStep(models.Model):
|
|||||||
db_suffix = build.params_id.config_data.get('db_name') or build.params_id.dump_db.db_suffix
|
db_suffix = build.params_id.config_data.get('db_name') or build.params_id.dump_db.db_suffix
|
||||||
migrate_db_name = '%s-%s' % (build.dest, db_suffix) # only ok if restore does not force db_suffix
|
migrate_db_name = '%s-%s' % (build.dest, db_suffix) # only ok if restore does not force db_suffix
|
||||||
|
|
||||||
migrate_cmd = build._cmd()
|
migrate_cmd = build._cmd(enable_log_db=self.enable_log_db)
|
||||||
migrate_cmd += ['-u all']
|
migrate_cmd += ['-u all']
|
||||||
migrate_cmd += ['-d', migrate_db_name]
|
migrate_cmd += ['-d', migrate_db_name]
|
||||||
migrate_cmd += ['--stop-after-init']
|
migrate_cmd += ['--stop-after-init']
|
||||||
|
@ -77,6 +77,7 @@
|
|||||||
<group string="Extra Parameters" attrs="{'invisible': [('job_type', 'not in', ('python', 'install_odoo', 'test_upgrade', 'run_odoo'))]}">
|
<group string="Extra Parameters" attrs="{'invisible': [('job_type', 'not in', ('python', 'install_odoo', 'test_upgrade', 'run_odoo'))]}">
|
||||||
<field name="extra_params"/>
|
<field name="extra_params"/>
|
||||||
<field name="additionnal_env"/>
|
<field name="additionnal_env"/>
|
||||||
|
<field name="enable_log_db"/>
|
||||||
</group>
|
</group>
|
||||||
<group string="Create settings" attrs="{'invisible': [('job_type', 'not in', ('python', 'create_build'))]}">
|
<group string="Create settings" attrs="{'invisible': [('job_type', 'not in', ('python', 'create_build'))]}">
|
||||||
<field name="create_config_ids" widget="many2many_tags" options="{'no_create': True}" />
|
<field name="create_config_ids" widget="many2many_tags" options="{'no_create': True}" />
|
||||||
|
Loading…
Reference in New Issue
Block a user