mirror of
https://github.com/odoo/runbot.git
synced 2025-03-15 23:45:44 +07:00
[IMP] runbot: add batch_dependent triggers
Params mechanism are a way to avoid to rebuild with the exact same params. Commit is the main identifier to know if two builds are the same, ususally commit_link are not usefull to uniquify params, exept when the mergebase is in use as in security check (based on diff). We would also like to avoid to have red diff-based build in sticky/base branches when the ci is ignored on a pr, but we want to keep the diff display on new batches (lines and files changed). We need a way to know if it is a is_base bundle. This was an initially forbidden behaviour because of duplicate detection. This commit add a batch_dependent flag. This will enable the use of the batch in the fingerprint, making it unique per batch and disabling duplicate detection/ in this case we can use the "is_base" information from the bundle + avoid false duplicate detection if trigger is based on mergebase-commit diff. (pr based on another pr now merged)
This commit is contained in:
parent
2556145843
commit
d76a41537c
@ -286,6 +286,7 @@ class Batch(models.Model):
|
||||
'commit_link_ids': [(6, 0, [commit_link_by_repos[repo.id].id for repo in trigger_repos])],
|
||||
'modules': bundle.modules,
|
||||
'dockerfile_id': dockerfile_id,
|
||||
'create_batch_id': self.id,
|
||||
}
|
||||
params_value['builds_reference_ids'] = trigger._reference_builds(bundle)
|
||||
|
||||
|
@ -49,6 +49,7 @@ class BuildParameters(models.Model):
|
||||
version_id = fields.Many2one('runbot.version', required=True, index=True)
|
||||
project_id = fields.Many2one('runbot.project', required=True, index=True) # for access rights
|
||||
trigger_id = fields.Many2one('runbot.trigger', index=True) # for access rights
|
||||
create_batch_id = fields.Many2one('runbot.batch')
|
||||
category = fields.Char('Category', index=True) # normal vs nightly vs weekly, ...
|
||||
dockerfile_id = fields.Many2one('runbot.dockerfile', index=True, default=lambda self: self.env.ref('runbot.docker_default', raise_if_not_found=False))
|
||||
skip_requirements = fields.Boolean('Skip requirements.txt auto install')
|
||||
@ -91,6 +92,8 @@ class BuildParameters(models.Model):
|
||||
'dockerfile_id': param.dockerfile_id.id,
|
||||
'skip_requirements': param.skip_requirements,
|
||||
}
|
||||
if param.trigger_id.batch_dependent:
|
||||
cleaned_vals['create_batch_id'] = param.create_batch_id.id,
|
||||
param.fingerprint = hashlib.sha256(str(cleaned_vals).encode('utf8')).hexdigest()
|
||||
|
||||
@api.depends('commit_link_ids')
|
||||
|
@ -43,6 +43,7 @@ class Trigger(models.Model):
|
||||
repo_ids = fields.Many2many('runbot.repo', relation='runbot_trigger_triggers', string="Triggers", domain="[('project_id', '=', project_id)]")
|
||||
dependency_ids = fields.Many2many('runbot.repo', relation='runbot_trigger_dependencies', string="Dependencies")
|
||||
config_id = fields.Many2one('runbot.build.config', string="Config", required=True)
|
||||
batch_dependent = fields.Boolean('Batch Dependent', help="Force adding batch in build parameters to make it unique and give access to bundle")
|
||||
|
||||
ci_context = fields.Char("Ci context", default='ci/runbot', tracking=True)
|
||||
category_id = fields.Many2one('runbot.category', default=lambda self: self.env.ref('runbot.default_category', raise_if_not_found=False))
|
||||
|
@ -16,6 +16,9 @@
|
||||
<field name="match_type"/>
|
||||
</tree>
|
||||
</field>
|
||||
<field name="trigger_id"/>
|
||||
<field name="create_batch_id"/>
|
||||
<field name="dockerfile_id"/>
|
||||
</group>
|
||||
</sheet>
|
||||
</form>
|
||||
|
@ -17,6 +17,7 @@
|
||||
<field name="repo_ids"/>
|
||||
<field name="dependency_ids"/>
|
||||
<field name="config_id"/>
|
||||
<field name="batch_dependent"/>
|
||||
<field name="version_domain" widget="domain" options="{'model': 'runbot.version', 'in_dialog': True}"/>
|
||||
<field name="hide"/>
|
||||
<field name="manual"/>
|
||||
|
Loading…
Reference in New Issue
Block a user