mirror of
https://github.com/odoo/runbot.git
synced 2025-04-01 15:55:45 +07:00
[IMP] runbot: add a way to add custom pre/post
Mainly usefull for custom triggers
This commit is contained in:
parent
70532df2d6
commit
30611c2ee8
@ -1083,7 +1083,12 @@ class BuildResult(models.Model):
|
|||||||
if grep(config_path, "no-netrpc"):
|
if grep(config_path, "no-netrpc"):
|
||||||
cmd.append("--no-netrpc")
|
cmd.append("--no-netrpc")
|
||||||
|
|
||||||
command = Command(pres, cmd, [], cmd_checker=build)
|
pres += self.params_id.config_data.get('pres', [])
|
||||||
|
posts = self.params_id.config_data.get('posts', [])
|
||||||
|
finals = self.params_id.config_data.get('finals', [])
|
||||||
|
config_tuples = self.params_id.config_data.get('config_tuples', [])
|
||||||
|
|
||||||
|
command = Command(pres, cmd, posts, finals=finals, config_tuples=config_tuples, cmd_checker=build)
|
||||||
|
|
||||||
# use the username of the runbot host to connect to the databases
|
# use the username of the runbot host to connect to the databases
|
||||||
command.add_config_tuple('db_user', '%s' % pwd.getpwuid(os.getuid()).pw_name)
|
command.add_config_tuple('db_user', '%s' % pwd.getpwuid(os.getuid()).pw_name)
|
||||||
|
@ -237,7 +237,7 @@ class TestBuildResult(RunbotCase):
|
|||||||
|
|
||||||
self.assertEqual(modules_to_test, sorted(['other_mod_2']))
|
self.assertEqual(modules_to_test, sorted(['other_mod_2']))
|
||||||
|
|
||||||
def test_build_cmd_log_db(self, ):
|
def test_build_cmd_log_db(self):
|
||||||
""" test that the log_db parameter is set in the .odoorc file """
|
""" test that the log_db parameter is set in the .odoorc file """
|
||||||
build = self.Build.create({
|
build = self.Build.create({
|
||||||
'params_id': self.server_params.id,
|
'params_id': self.server_params.id,
|
||||||
@ -245,6 +245,25 @@ class TestBuildResult(RunbotCase):
|
|||||||
cmd = build._cmd(py_version=3)
|
cmd = build._cmd(py_version=3)
|
||||||
self.assertIn('log_db = runbot_logs', cmd.get_config())
|
self.assertIn('log_db = runbot_logs', cmd.get_config())
|
||||||
|
|
||||||
|
|
||||||
|
def test_build_cmd_custom_pre_post(self):
|
||||||
|
""" test that the log_db parameter is set in the .odoorc file """
|
||||||
|
custom_pre = ['pip install something:someversion'.split()]
|
||||||
|
custom_post = ["psql -l > database list".split()]
|
||||||
|
self.server_params.config_data = {
|
||||||
|
'pres': [custom_pre],
|
||||||
|
'posts': [custom_post],
|
||||||
|
}
|
||||||
|
self.env.flush_all()
|
||||||
|
build = self.Build.create({
|
||||||
|
'params_id': self.server_params.id,
|
||||||
|
})
|
||||||
|
cmd = build._cmd(py_version=3)
|
||||||
|
self.assertIn('python3 -m pip install --user --progress-bar off -r server/requirements.txt'.split(), cmd.pres)
|
||||||
|
self.assertIn(custom_pre, cmd.pres)
|
||||||
|
self.assertIn(custom_post, cmd.posts)
|
||||||
|
|
||||||
|
|
||||||
def test_build_cmd_server_path_no_dep(self):
|
def test_build_cmd_server_path_no_dep(self):
|
||||||
""" test that the server path and addons path """
|
""" test that the server path and addons path """
|
||||||
build = self.Build.create({
|
build = self.Build.create({
|
||||||
|
Loading…
Reference in New Issue
Block a user