Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IMP] runbot: allow to disable upgrade from a version #880

Open
wants to merge 1 commit into
base: 17.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions runbot/models/build_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -809,14 +809,16 @@ def _reference_batches(self, batch, trigger):

def _reference_batches_complement(self, batch, trigger):
bundle = batch.bundle_id
if not bundle.base_id.to_upgrade or not bundle.base_id.to_upgrade_from:
return self.env['runbot.batch']
category_id = trigger.upgrade_dumps_trigger_id.category_id.id
version = bundle.version_id
next_versions = version.next_major_version_id | version.next_intermediate_version_ids # TODO filter on trigger version
target_versions = version.browse()

upgrade_complement_step = trigger.upgrade_dumps_trigger_id.upgrade_step_id

if next_versions and bundle.base_id.to_upgrade:
if next_versions:
for next_version in next_versions:
if bundle.version_id in upgrade_complement_step._get_upgrade_source_versions(next_version):
target_versions |= next_version
Expand Down Expand Up @@ -858,7 +860,7 @@ def from_versions(f_bundle):
from_versions(bundle)
for f_bundle in target_refs_bundles:
from_versions(f_bundle)
source_refs_bundles = source_refs_bundles.filtered('to_upgrade')
source_refs_bundles = source_refs_bundles.filtered('to_upgrade_from')

return (target_refs_bundles | source_refs_bundles).with_context(
category_id=category_id
Expand Down
6 changes: 6 additions & 0 deletions runbot/models/bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class Bundle(models.Model):
defined_base_id = fields.Many2one('runbot.bundle', 'Forced base bundle', domain="[('project_id', '=', project_id), ('is_base', '=', True)]")
base_id = fields.Many2one('runbot.bundle', 'Base bundle', compute='_compute_base_id', store=True)
to_upgrade = fields.Boolean('To upgrade', compute='_compute_to_upgrade', store=True, index=False)
to_upgrade_from = fields.Boolean('To upgrade From', compute='_compute_to_upgrade_from', store=True, index=False)

has_pr = fields.Boolean('Has PR', compute='_compute_has_pr', store=True)

Expand Down Expand Up @@ -89,6 +90,11 @@ def _compute_to_upgrade(self):
for bundle in self:
bundle.to_upgrade = bundle.is_base

@api.depends('is_base')
def _compute_to_upgrade_from(self):
for bundle in self:
bundle.to_upgrade_from = bundle.is_base

@api.depends('name', 'is_base', 'defined_base_id', 'base_id.is_base', 'project_id')
def _compute_base_id(self):
for bundle in self:
Expand Down
4 changes: 4 additions & 0 deletions runbot/views/bundle_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
<field name="project_id"/>
<field name="sticky" readonly="0"/>
<field name="to_upgrade" readonly="0"/>
<field name="to_upgrade_from" readonly="0"/>
<field name="is_base"/>
<field name="base_id"/>
<field name="defined_base_id"/>
Expand Down Expand Up @@ -150,6 +151,7 @@
<field name="is_base"/>
<field name="sticky"/>
<field name="to_upgrade"/>
<field name="to_upgrade_from"/>
<field name="no_build"/>
<field name="branch_ids"/>
<field name="version_id"/>
Expand All @@ -168,6 +170,8 @@
<filter string="For next freeze" name="for_next_freeze" domain="[('for_next_freeze', '=', True)]"/>
<filter string="Has open pr" name="has_pr" domain="[('has_pr', '=', True)]"/>
<filter string="No pr" name="no_pr" domain="[('branch_ids', '!=', []), '!', ('branch_ids', 'any', [('is_pr', '=', True)])]"/>
<filter string="Is base" name="is_base" domain="[('is_base', '=', True)]"/>
<filter string="Is sticky" name="is_sticky" domain="[('sticky', '=', True)]"/>
<separator/>
</search>
</field>
Expand Down
3 changes: 2 additions & 1 deletion runbot_builder/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,10 @@ def run(client_class):
config_addons_path = ','.join([config_addons_path, addon_path])
odoo.tools.config['addons_path'] = config_addons_path
odoo.tools.config['forced_host_name'] = args.forced_host_name
import odoo.modules

# create environment
registry = odoo.registry(args.database)
registry = odoo.modules.registry.Registry(args.database)
try:
with registry.cursor() as cr:
env = odoo.api.Environment(cr, odoo.SUPERUSER_ID, {})
Expand Down