[FIX] runbot: fix staging creation

This commit is contained in:
Xavier-Do 2024-03-20 09:47:51 +01:00
parent a00fa04e07
commit fd7f49aff8
2 changed files with 9 additions and 1 deletions

View File

@ -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:

View File

@ -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})