mirror of
https://github.com/odoo/runbot.git
synced 2025-03-15 15:35:46 +07:00
[IMP] runbot: support environment variables in config data
This commit is contained in:
parent
344792a191
commit
f7003fb964
@ -509,6 +509,8 @@ class ConfigStep(models.Model):
|
||||
cmd.finals.append(['flamegraph.pl', '--title', 'Flamegraph %s for build %s' % (self.name, build.id), self._perfs_data_path(), '>', self._perfs_data_path(ext='svg')])
|
||||
cmd.finals.append(['gzip', '-f', self._perfs_data_path()]) # keep data but gz them to save disc space
|
||||
env_variables = self.additionnal_env.split(';') if self.additionnal_env else []
|
||||
if config_env_variables := build.params_id.config_data.get('env_variables', False):
|
||||
env_variables += config_env_variables.split(';')
|
||||
return dict(cmd=cmd, ro_volumes=exports, env_variables=env_variables)
|
||||
|
||||
def _upgrade_create_childs(self):
|
||||
|
@ -537,6 +537,20 @@ class TestBuildConfigStep(TestBuildConfigStepCommon):
|
||||
tags = self.get_test_tags(params)
|
||||
self.assertEqual(tags, '-at_install,/module1,/module2,-:otherclass.othertest')
|
||||
|
||||
@patch('odoo.addons.runbot.models.build.BuildResult._parse_config')
|
||||
@patch('odoo.addons.runbot.models.build.BuildResult._checkout')
|
||||
def test_install_custom_env_variables(self, mock_checkout, parse_config):
|
||||
parse_config.return_value = {'--test-enable', '--test-tags'}
|
||||
config_step = self.ConfigStep.create({
|
||||
'name': 'all',
|
||||
'job_type': 'install_odoo'
|
||||
})
|
||||
|
||||
child = self.parent_build._add_child({'config_data': {'env_variables': 'CHROME_CPU_THROTTLE=10'}})
|
||||
|
||||
params = config_step._run_install_odoo(child)
|
||||
env_variables = params.get('env_variables', [])
|
||||
self.assertEqual(env_variables, ['CHROME_CPU_THROTTLE=10'])
|
||||
|
||||
@patch('odoo.addons.runbot.models.build.BuildResult._checkout')
|
||||
def test_db_name(self, mock_checkout):
|
||||
|
Loading…
Reference in New Issue
Block a user