From fd7f49aff839c2609318f2e57a09108dccc064cc Mon Sep 17 00:00:00 2001 From: Xavier-Do Date: Wed, 20 Mar 2024 09:47:51 +0100 Subject: [PATCH] [FIX] runbot: fix staging creation --- runbot/models/bundle.py | 2 +- runbot/tests/test_branch.py | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/runbot/models/bundle.py b/runbot/models/bundle.py index 8f6282f7..8d07b007 100644 --- a/runbot/models/bundle.py +++ b/runbot/models/bundle.py @@ -211,7 +211,7 @@ class Bundle(models.Model): elif record.project_id.tmp_prefix and record.name.startswith(record.project_id.tmp_prefix): record['no_build'] = True elif record.project_id.staging_prefix and record.name.startswith(record.project_id.staging_prefix): - name = record.name.removeprefix(record.project_id.staging_prefix, '') + name = record.name.removeprefix(record.project_id.staging_prefix) base = record.env['runbot.bundle'].search([('name', '=', name), ('project_id', '=', record.project_id.id), ('is_base', '=', True)], limit=1) record['build_all'] = True if base: diff --git a/runbot/tests/test_branch.py b/runbot/tests/test_branch.py index 9d5f32e9..0824ffbf 100644 --- a/runbot/tests/test_branch.py +++ b/runbot/tests/test_branch.py @@ -173,6 +173,14 @@ class TestBranchIsBase(RunbotCaseMinimalSetup): self.assertTrue(branch.bundle_id.is_base, "A branch matching the is_base_regex parameter should create is_base bundle") self.assertTrue(branch.bundle_id.sticky, "A branch matching the is_base_regex parameter should create sticky bundle") + staging = self.Branch.create({ + 'remote_id': self.remote_server.id, + 'name': 'staging.saas-13.4', + 'is_pr': False, + }) + self.assertEqual(staging.bundle_id.base_id, branch.bundle_id, 'The staging branch should have the correct nase bundle') + + def test_host(self): r10 = self.env['runbot.host'].create({'name': 'runbot10.odoo.com'}) r12 = self.env['runbot.host'].create({'name': 'runbot12.odoo.com', 'assigned_only': True})