diff --git a/runbot/models/branch.py b/runbot/models/branch.py index 977300b6..bf3b81d3 100644 --- a/runbot/models/branch.py +++ b/runbot/models/branch.py @@ -222,6 +222,9 @@ class Branch(models.Model): self.bundle_id.defined_base_id = base.id self.bundle_id._force() + if self.draft: + self.reviewers = '' # reset reviewers on draft + if (not self.draft and was_draft) or (self.alive and not was_alive) or (self.target_branch_name != init_target_branch_name and self.alive): self.bundle_id._force() diff --git a/runbot/models/host.py b/runbot/models/host.py index ae251dd1..c159fa6d 100644 --- a/runbot/models/host.py +++ b/runbot/models/host.py @@ -1,9 +1,11 @@ import logging from odoo import models, fields, api +from odoo.tools import config from ..common import fqdn, local_pgadmin_cursor, os from ..container import docker_build _logger = logging.getLogger(__name__) +forced_host_name = None class Host(models.Model): _name = 'runbot.host' @@ -94,8 +96,8 @@ class Host(models.Model): return os.path.abspath(os.path.join(os.path.dirname(__file__), '../static')) @api.model - def _get_current(self, suffix=''): - name = '%s%s' % (fqdn(), suffix) + def _get_current(self): + name = config.get('forced_host_name') or fqdn() return self.search([('name', '=', name)]) or self.create({'name': name}) def get_running_max(self): diff --git a/runbot/models/repo.py b/runbot/models/repo.py index 41f130e7..acc746de 100644 --- a/runbot/models/repo.py +++ b/runbot/models/repo.py @@ -366,7 +366,7 @@ class Repo(models.Model): if not git_refs: return [] refs = [tuple(field for field in line.split('\x00')) for line in git_refs.split('\n')] - refs = [r for r in refs if dateutil.parser.parse(r[2][:19]) + datetime.timedelta(days=max_age) > datetime.datetime.now() or self.env['runbot.branch'].match_is_base(r[0])] + refs = [r for r in refs if dateutil.parser.parse(r[2][:19]) + datetime.timedelta(days=max_age) > datetime.datetime.now() or self.env['runbot.branch'].match_is_base(r[0].split('\n')[-1])] if ignore: refs = [r for r in refs if r[0].split('/')[-1] not in ignore] return refs diff --git a/runbot/views/repo_views.xml b/runbot/views/repo_views.xml index 06d8d1f3..efac1996 100644 --- a/runbot/views/repo_views.xml +++ b/runbot/views/repo_views.xml @@ -44,6 +44,8 @@ + + diff --git a/runbot_builder/tools.py b/runbot_builder/tools.py index fc0a5ae6..64b02c5e 100644 --- a/runbot_builder/tools.py +++ b/runbot_builder/tools.py @@ -46,6 +46,7 @@ class RunbotClient(): while True: try: self.host.last_start_loop = fields.Datetime.now() + self.env.cr.commit() self.count = self.count % self.max_count sleep_time = self.loop_turn() self.count += 1 @@ -90,6 +91,8 @@ def run(client_class): parser.add_argument('--db_password') parser.add_argument('-d', '--database', default='runbot', help='name of runbot db') parser.add_argument('--logfile', default=False) + parser.add_argument('--forced-host-name', default=False) + args = parser.parse_args() if args.logfile: dirname = os.path.dirname(args.logfile) @@ -113,6 +116,8 @@ def run(client_class): config_addons_path = odoo.tools.config['addons_path'] odoo.tools.config['addons_path'] = ','.join([config_addons_path, addon_path]) + odoo.tools.config['forced_host_name'] = args.forced_host_name + # create environment registry = odoo.registry(args.database) with odoo.api.Environment.manage():