[IMP] runbot: add a Dockerfile on project

Some projects may use a totally different Dockerfile. In order to avoid
new branches of those projects to automatically build with the generic
default Dockerfile, this commit adds the possibility to configure a
Default Dockerfile on a project.
This commit is contained in:
Christophe Monniez 2021-06-24 09:11:59 +02:00 committed by xdo
parent b015ec6840
commit 6e5d722882
5 changed files with 6 additions and 1 deletions

View File

@ -135,7 +135,7 @@ class Batch(models.Model):
if not bundle.version_id:
_logger.error('No version found on bundle %s in project %s', bundle.name, project.name)
dockerfile_id = bundle.dockerfile_id or bundle.base_id.dockerfile_id or bundle.version_id.dockerfile_id
dockerfile_id = bundle.dockerfile_id or bundle.base_id.dockerfile_id or bundle.version_id.dockerfile_id or bundle.project_id.dockerfile_id
if not dockerfile_id:
_logger.error('No dockerfile found !')

View File

@ -20,6 +20,7 @@ class Dockerfile(models.Model):
version_ids = fields.One2many('runbot.version', 'dockerfile_id', string='Versions')
description = fields.Text('Description')
view_ids = fields.Many2many('ir.ui.view', compute='_compute_view_ids')
project_ids = fields.One2many('runbot.project', 'dockerfile_id', string='Default for Projects')
bundle_ids = fields.One2many('runbot.bundle', 'dockerfile_id', string='Used in Bundles')
_sql_constraints = [('runbot_dockerfile_name_unique', 'unique(name)', 'A Dockerfile with this name already exists')]

View File

@ -9,6 +9,7 @@ class Project(models.Model):
group_ids = fields.Many2many('res.groups', string='Required groups')
trigger_ids = fields.One2many('runbot.trigger', 'project_id', string='Triggers')
dockerfile_id = fields.Many2one('runbot.dockerfile', index=True, help="Project Default Dockerfile")
class Category(models.Model):

View File

@ -7,6 +7,7 @@
<form string="Projects">
<group>
<field name="name"/>
<field name="dockerfile_id"/>
<field name="group_ids"/>
<field name="trigger_ids"/>
</group>

View File

@ -12,6 +12,7 @@
<field name="image_tag"/>
<field name="to_build"/>
<field name="version_ids" widget="many2many_tags"/>
<field name="project_ids" widget="many2many_tags"/>
<field name="template_id"/>
</group>
<group>
@ -59,6 +60,7 @@
<field name="image_tag"/>
<field name="to_build"/>
<field name="version_ids" widget="many2many_tags"/>
<field name="project_ids" widget="many2many_tags"/>
<field name="bundle_ids"/>
<field name="dockerfile" invisible="True"/>
</tree>