mirror of
https://github.com/odoo/runbot.git
synced 2025-03-27 13:25:47 +07:00
[IMP] runbot - Search in the 10 last builds to find a running. Redirect by default in debug mode.
This commit is contained in:
parent
ca64d736d0
commit
eb67bb79f4
@ -1220,16 +1220,25 @@ class RunbotController(http.Controller):
|
|||||||
Build = pool['runbot.build']
|
Build = pool['runbot.build']
|
||||||
|
|
||||||
domain = [('branch_id.branch_name', '=', branch_name)]
|
domain = [('branch_id.branch_name', '=', branch_name)]
|
||||||
builds = Build.search(cr, uid, domain, order="sequence desc", limit=1, context=context)
|
|
||||||
|
# Take the 10 lasts builds to find at least 1 running... Else no luck
|
||||||
|
builds = Build.search(cr, uid, domain, order="sequence desc", limit=10, context=context)
|
||||||
|
|
||||||
if builds:
|
if builds:
|
||||||
last_build = Build.browse(cr, uid, builds[0], context=context)
|
last_build = False
|
||||||
if last_build.state == 'duplicate':
|
for build in Build.browse(cr, uid, builds, context=context):
|
||||||
last_build = last_build.duplicate_id
|
if build.state in ['duplicate', 'running']:
|
||||||
|
last_build = build.state == 'running' and build or build.duplicate_id
|
||||||
|
break;
|
||||||
|
|
||||||
|
if not last_build:
|
||||||
|
# Find the last build regardless the state to propose a rebuild
|
||||||
|
last_build = Build.browse(cr, uid, builds[0], context=context)
|
||||||
|
|
||||||
if last_build.state != 'running':
|
if last_build.state != 'running':
|
||||||
url = "/runbot/build/%s?ask_rebuild=1" % last_build.id
|
url = "/runbot/build/%s?ask_rebuild=1" % last_build.id
|
||||||
else:
|
else:
|
||||||
url = ("http://%s/login?db=%s-all&login=admin&key=admin" %
|
url = ("http://%s/login?db=%s-all&login=admin&key=admin&redirect=/web?debug=1" %
|
||||||
(last_build.domain, last_build.dest))
|
(last_build.domain, last_build.dest))
|
||||||
else:
|
else:
|
||||||
return request.not_found()
|
return request.not_found()
|
||||||
|
Loading…
Reference in New Issue
Block a user