mirror of
https://github.com/odoo/runbot.git
synced 2025-03-27 13:25:47 +07:00
[REL] runbot: adapt for 17.0
This commit is contained in:
parent
e9fc57816b
commit
e83db83533
@ -104,23 +104,4 @@ admin_passwd=running_master_password</field>
|
|||||||
<field name="code">model._cron()</field>
|
<field name="code">model._cron()</field>
|
||||||
<field name="state">code</field>
|
<field name="state">code</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
|
||||||
<record id="bundle_create" model="base.automation">
|
|
||||||
<field name="name">Base, staging and tmp management</field>
|
|
||||||
<field name="model_id" ref="runbot.model_runbot_bundle"/>
|
|
||||||
<field name="trigger">on_create</field>
|
|
||||||
<field name="active" eval="True"/>
|
|
||||||
<field name="state">code</field>
|
|
||||||
<field name="code">
|
|
||||||
if record.name.startswith('tmp.'):
|
|
||||||
record['no_build'] = True
|
|
||||||
elif record.name.startswith('staging.'):
|
|
||||||
name = record.name.replace('staging.', '')
|
|
||||||
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:
|
|
||||||
record['defined_base_id'] = base
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
</odoo>
|
</odoo>
|
||||||
|
@ -30,14 +30,14 @@ class Branch(models.Model):
|
|||||||
pr_body = fields.Char('Pr Body')
|
pr_body = fields.Char('Pr Body')
|
||||||
pr_author = fields.Char('Pr Author')
|
pr_author = fields.Char('Pr Author')
|
||||||
|
|
||||||
pull_head_name = fields.Char(compute='_compute_branch_infos', string='PR HEAD name', readonly=1, store=True)
|
pull_head_name = fields.Char(compute='_compute_branch_infos', string='PR HEAD name', readonly=True, store=True)
|
||||||
pull_head_remote_id = fields.Many2one('runbot.remote', 'Pull head repository', compute='_compute_branch_infos', store=True, index=True)
|
pull_head_remote_id = fields.Many2one('runbot.remote', 'Pull head repository', compute='_compute_branch_infos', store=True, index=True)
|
||||||
target_branch_name = fields.Char(compute='_compute_branch_infos', string='PR target branch', store=True)
|
target_branch_name = fields.Char(compute='_compute_branch_infos', string='PR target branch', store=True)
|
||||||
reviewers = fields.Char('Reviewers')
|
reviewers = fields.Char('Reviewers')
|
||||||
|
|
||||||
reflog_ids = fields.One2many('runbot.ref.log', 'branch_id')
|
reflog_ids = fields.One2many('runbot.ref.log', 'branch_id')
|
||||||
|
|
||||||
branch_url = fields.Char(compute='_compute_branch_url', string='Branch url', readonly=1)
|
branch_url = fields.Char(compute='_compute_branch_url', string='Branch url', readonly=True)
|
||||||
dname = fields.Char('Display name', compute='_compute_dname', search='_search_dname')
|
dname = fields.Char('Display name', compute='_compute_dname', search='_search_dname')
|
||||||
|
|
||||||
alive = fields.Boolean('Alive', default=True)
|
alive = fields.Boolean('Alive', default=True)
|
||||||
|
@ -173,7 +173,7 @@ class BuildResult(models.Model):
|
|||||||
keep_host = fields.Boolean('Keep host on rebuild and for children')
|
keep_host = fields.Boolean('Keep host on rebuild and for children')
|
||||||
|
|
||||||
port = fields.Integer('Port')
|
port = fields.Integer('Port')
|
||||||
dest = fields.Char(compute='_compute_dest', type='char', string='Dest', readonly=1, store=True)
|
dest = fields.Char(compute='_compute_dest', type='char', string='Dest', readonly=True, store=True)
|
||||||
domain = fields.Char(compute='_compute_domain', type='char', string='URL')
|
domain = fields.Char(compute='_compute_domain', type='char', string='URL')
|
||||||
# logs and stats
|
# logs and stats
|
||||||
log_ids = fields.One2many('ir.logging', 'build_id', string='Logs')
|
log_ids = fields.One2many('ir.logging', 'build_id', string='Logs')
|
||||||
|
@ -196,17 +196,26 @@ class Bundle(models.Model):
|
|||||||
return "/runbot/bundle/%s" % self.id
|
return "/runbot/bundle/%s" % self.id
|
||||||
|
|
||||||
def create(self, values_list):
|
def create(self, values_list):
|
||||||
res = super().create(values_list)
|
records = super().create(values_list)
|
||||||
if res.is_base:
|
for record in records:
|
||||||
model = self.browse()
|
if records.is_base:
|
||||||
model._get_base_ids.clear_cache(model)
|
model = self.browse()
|
||||||
return res
|
model.env.registry.clear_cache()
|
||||||
|
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, '')
|
||||||
|
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:
|
||||||
|
record['defined_base_id'] = base
|
||||||
|
return records
|
||||||
|
|
||||||
def write(self, values):
|
def write(self, values):
|
||||||
res = super().write(values)
|
res = super().write(values)
|
||||||
if 'is_base' in values:
|
if 'is_base' in values:
|
||||||
model = self.browse()
|
model = self.browse()
|
||||||
model._get_base_ids.clear_cache(model)
|
model.env.registry.clear_cache()
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def _force(self, category_id=None):
|
def _force(self, category_id=None):
|
||||||
|
@ -124,7 +124,6 @@ class Host(models.Model):
|
|||||||
""" build docker images needed by locally pending builds"""
|
""" build docker images needed by locally pending builds"""
|
||||||
_logger.info('Building docker images...')
|
_logger.info('Building docker images...')
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
self.clear_caches() # needed to ensure that content is updated on all hosts
|
|
||||||
for dockerfile in self.env['runbot.dockerfile'].search([('to_build', '=', True)]):
|
for dockerfile in self.env['runbot.dockerfile'].search([('to_build', '=', True)]):
|
||||||
self._docker_build_dockerfile(dockerfile)
|
self._docker_build_dockerfile(dockerfile)
|
||||||
_logger.info('Done...')
|
_logger.info('Done...')
|
||||||
|
@ -18,7 +18,8 @@ class Project(models.Model):
|
|||||||
master_bundle_id = fields.Many2one('runbot.bundle', string='Master bundle')
|
master_bundle_id = fields.Many2one('runbot.bundle', string='Master bundle')
|
||||||
dummy_bundle_id = fields.Many2one('runbot.bundle', string='Dummy bundle')
|
dummy_bundle_id = fields.Many2one('runbot.bundle', string='Dummy bundle')
|
||||||
always_use_foreign = fields.Boolean('Use foreign bundle', help='By default, check for the same bundle name in another project to fill missing commits.', default=False)
|
always_use_foreign = fields.Boolean('Use foreign bundle', help='By default, check for the same bundle name in another project to fill missing commits.', default=False)
|
||||||
|
tmp_prefix = fields.Char('tmp branches prefix', default="tmp.")
|
||||||
|
staging_prefix = fields.Char('staging branches prefix', default="staging.")
|
||||||
|
|
||||||
@api.model_create_multi
|
@api.model_create_multi
|
||||||
def create(self, vals_list):
|
def create(self, vals_list):
|
||||||
|
@ -39,7 +39,7 @@ class Version(models.Model):
|
|||||||
@api.model_create_multi
|
@api.model_create_multi
|
||||||
def create(self, vals_list):
|
def create(self, vals_list):
|
||||||
model = self.browse()
|
model = self.browse()
|
||||||
model._get_id.clear_cache(model)
|
model.env.registry.clear_cache()
|
||||||
return super().create(vals_list)
|
return super().create(vals_list)
|
||||||
|
|
||||||
def _get(self, name):
|
def _get(self, name):
|
||||||
|
@ -59,6 +59,10 @@ class RunbotClient():
|
|||||||
try:
|
try:
|
||||||
self.host.last_start_loop = fields.Datetime.now()
|
self.host.last_start_loop = fields.Datetime.now()
|
||||||
self.env.cr.commit()
|
self.env.cr.commit()
|
||||||
|
if self.env.registry != self.pool.check_signaling():
|
||||||
|
# the registry has changed, reload self in the new registry
|
||||||
|
self.env.reset()
|
||||||
|
self.env = self.env() #not sure
|
||||||
self.count = self.count % self.max_count
|
self.count = self.count % self.max_count
|
||||||
if self.host.paused:
|
if self.host.paused:
|
||||||
sleep_time = 5
|
sleep_time = 5
|
||||||
|
Loading…
Reference in New Issue
Block a user