[FIX] runbot: keep host for child when host is assigned.

This commit is contained in:
Xavier-Do 2020-09-14 11:29:21 +02:00
parent 0a766d0a1a
commit e1e965778b
3 changed files with 11 additions and 1 deletions

View File

@ -117,6 +117,7 @@ class Batch(models.Model):
}) })
if self.bundle_id.host_id: if self.bundle_id.host_id:
build.host = self.bundle_id.host_id.name build.host = self.bundle_id.host_id.name
build.keep_host = True
build._github_status(post_commit=False) build._github_status(post_commit=False)
return link_type, build return link_type, build

View File

@ -151,6 +151,8 @@ class BuildResult(models.Model):
requested_action = fields.Selection([('wake_up', 'To wake up'), ('deathrow', 'To kill')], string='Action requested', index=True) requested_action = fields.Selection([('wake_up', 'To wake up'), ('deathrow', 'To kill')], string='Action requested', index=True)
# web infos # web infos
host = fields.Char('Host') host = fields.Char('Host')
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=1, store=True)
domain = fields.Char(compute='_compute_domain', type='char', string='URL') domain = fields.Char(compute='_compute_domain', type='char', string='URL')
@ -317,12 +319,15 @@ class BuildResult(models.Model):
commit_link_ids = self.params_id.commit_link_ids commit_link_ids = self.params_id.commit_link_ids
commit_link_ids |= additionnal_commit_links commit_link_ids |= additionnal_commit_links
param_values['commit_link_ids'] = commit_link_ids param_values['commit_link_ids'] = commit_link_ids
return self.create({ return self.create({
'params_id': self.params_id.copy(param_values).id, 'params_id': self.params_id.copy(param_values).id,
'parent_id': self.id, 'parent_id': self.id,
'build_type': self.build_type, 'build_type': self.build_type,
'description': description, 'description': description,
'orphan_result': orphan, 'orphan_result': orphan,
'keep_host': self.keep_host,
'host': self.host if self.keep_host else '',
}) })
def result_multi(self): def result_multi(self):
@ -418,6 +423,9 @@ class BuildResult(models.Model):
'params_id': self.params_id.id, 'params_id': self.params_id.id,
'build_type': 'rebuild', 'build_type': 'rebuild',
} }
if self.keep_host:
values['host'] = self.host
values['keep_host'] = True
if self.parent_id: if self.parent_id:
values.update({ values.update({
'parent_id': self.parent_id.id, 'parent_id': self.parent_id.id,
@ -1072,7 +1080,7 @@ class BuildResult(models.Model):
_logger.debug('Skipping result for orphan build %s', self.id) _logger.debug('Skipping result for orphan build %s', self.id)
else: else:
build.parent_id._github_status(post_commit) build.parent_id._github_status(post_commit)
elif build.params_id.config_id == build.params_id.trigger_id.config_id: elif build.params_id.config_id == build.params_id.trigger_id.config_id:
if build.global_result in ('ko', 'warn'): if build.global_result in ('ko', 'warn'):
state = 'failure' state = 'failure'
elif build.global_state in ('pending', 'testing'): elif build.global_state in ('pending', 'testing'):

View File

@ -33,6 +33,7 @@
<field name="no_auto_run"/> <field name="no_auto_run"/>
<field name="priority"/> <field name="priority"/>
<field name="build_all"/> <field name="build_all"/>
<field name="host_id"/>
<field name="branch_ids"> <field name="branch_ids">
<tree> <tree>
<field name="dname"/> <field name="dname"/>