[FIX] runbot: various small fixes and imps

This commit is contained in:
Xavier-Do 2019-08-26 14:31:58 +02:00
parent f94c8d7390
commit 7382aa6b79
5 changed files with 8 additions and 4 deletions

View File

@ -326,6 +326,7 @@ class Runbot(Controller):
WHERE config_id = %s
AND global_state in ('running', 'done')
AND branch_id in (SELECT id FROM runbot_branch where sticky='t')
AND local_state != 'duplicate'
ORDER BY branch_id ASC, id DESC""", [int(monitored_config_id)])
last_monitored = request.env['runbot.build'].browse([r[1] for r in request.env.cr.fetchall()])

View File

@ -560,6 +560,7 @@ class runbot_build(models.Model):
build.write({'job_start': now(), 'job_end': False, 'active_step': False, 'requested_action': False, 'local_state': 'running'})
build._log('wake_up', 'Waking up build', level='SEPARATOR')
self.env['runbot.build.config.step']._run_odoo_run(build, log_path)
# reload_nginx will be triggered by _run_odoo_run
except Exception:
_logger.exception('Failed to wake up build %s', build.dest)
build._log('_schedule', 'Failed waking up build', level='ERROR')

View File

@ -278,7 +278,9 @@ class ConfigStep(models.Model):
build_port = build.port
self.env.cr.commit() # commit before docker run to be 100% sure that db state is consistent with dockers
self.invalidate_cache()
return docker_run(cmd.build(), log_path, build_path, docker_name, exposed_ports=[build_port, build_port + 1], ro_volumes=exports)
res = docker_run(cmd.build(), log_path, build_path, docker_name, exposed_ports=[build_port, build_port + 1], ro_volumes=exports)
build.repo_id._reload_nginx()
return res
def _run_odoo_install(self, build, log_path):
exports = build._checkout()

View File

@ -593,11 +593,11 @@ class runbot_repo(models.Model):
self = self.env()[self._name]
self._reload_nginx()
time.sleep(update_frequency)
except TransactionRollbackError:
except TransactionRollbackError: # can lead to psycopg2.InternalError'>: "current transaction is aborted, commands ignored until end of transaction block
_logger.exception('Trying to rollback')
self.env.cr.rollback()
self.env.reset()
time.sleep(random.uniform(0, 1))
time.sleep(random.uniform(0, 3))
except Exception as e:
with registry(self._cr.dbname).cursor() as cr: # user another cursor since transaction will be rollbacked
message = str(e)

View File

@ -88,7 +88,7 @@
<filter string="Testing" domain="[('global_state','in', ('testing', 'waiting'))]"/>
<filter string="Running" domain="[('global_state','=', 'running')]"/>
<filter string="Done" domain="[('global_state','=','done')]"/>
<filter string="Duplicate" domain="[('global_state','=', 'duplicate')]"/>
<filter string="Duplicate" domain="[('local_state','=', 'duplicate')]"/>
<separator />
<group expand="0" string="Group By...">
<filter string="Repo" domain="[]" context="{'group_by':'repo_id'}"/>