mirror of
https://github.com/odoo/runbot.git
synced 2025-03-27 13:25:47 +07:00
[IMP] display duplicate builds
This commit is contained in:
parent
40a1d8010b
commit
0c8ddf2a0d
@ -307,7 +307,6 @@ class runbot_repo(osv.osv):
|
|||||||
pending_ids = Build.search(cr, uid, domain + [('state', '=', 'pending')], order="sequence", limit=1)
|
pending_ids = Build.search(cr, uid, domain + [('state', '=', 'pending')], order="sequence", limit=1)
|
||||||
|
|
||||||
pending_build = Build.browse(cr, uid, pending_ids[0])
|
pending_build = Build.browse(cr, uid, pending_ids[0])
|
||||||
print 'scheduling build', pending_build
|
|
||||||
pending_build.schedule()
|
pending_build.schedule()
|
||||||
|
|
||||||
# compute the number of testing and pending jobs again
|
# compute the number of testing and pending jobs again
|
||||||
@ -425,14 +424,14 @@ class runbot_build(osv.osv):
|
|||||||
return r
|
return r
|
||||||
|
|
||||||
def _get_domain(self, cr, uid, ids, field_name, arg, context=None):
|
def _get_domain(self, cr, uid, ids, field_name, arg, context=None):
|
||||||
r = {}
|
result = {}
|
||||||
domain = self.pool['runbot.repo'].domain(cr, uid)
|
domain = self.pool['runbot.repo'].domain(cr, uid)
|
||||||
for build in self.browse(cr, uid, ids, context=context):
|
for build in self.browse(cr, uid, ids, context=context):
|
||||||
if build.repo_id.nginx:
|
if build.repo_id.nginx:
|
||||||
r[build.id] = "%s.%s" % (build.dest, domain)
|
result[build.id] = "%s.%s" % (build.dest, domain)
|
||||||
else:
|
else:
|
||||||
r[build.id] = "%s:%s" % (domain, build.port)
|
result[build.id] = "%s:%s" % (domain, build.port)
|
||||||
return r
|
return result
|
||||||
|
|
||||||
_columns = {
|
_columns = {
|
||||||
'branch_id': fields.many2one('runbot.branch', 'Branch', required=True, ondelete='cascade'),
|
'branch_id': fields.many2one('runbot.branch', 'Branch', required=True, ondelete='cascade'),
|
||||||
@ -885,7 +884,6 @@ class RunbotController(http.Controller):
|
|||||||
context = {
|
context = {
|
||||||
'repos': repos,
|
'repos': repos,
|
||||||
'repo': repo,
|
'repo': repo,
|
||||||
's2h': s2human,
|
|
||||||
'workers': icp.get_param(cr, uid, 'runbot.workers', default=6),
|
'workers': icp.get_param(cr, uid, 'runbot.workers', default=6),
|
||||||
'running_max': icp.get_param(cr, uid, 'runbot.running_max', default=75),
|
'running_max': icp.get_param(cr, uid, 'runbot.running_max', default=75),
|
||||||
'pending_total': build_obj.search_count(cr, uid, [('state','=','pending')]),
|
'pending_total': build_obj.search_count(cr, uid, [('state','=','pending')]),
|
||||||
@ -918,10 +916,29 @@ class RunbotController(http.Controller):
|
|||||||
build_ids = flatten(build_by_branch_ids.values())
|
build_ids = flatten(build_by_branch_ids.values())
|
||||||
build_dict = {build.id: build for build in build_obj.browse(cr, uid, build_ids, context=request.context) }
|
build_dict = {build.id: build for build in build_obj.browse(cr, uid, build_ids, context=request.context) }
|
||||||
|
|
||||||
|
def build_info(build):
|
||||||
|
real_build = build.duplicate_id if build.state == 'duplicate' else build
|
||||||
|
return {
|
||||||
|
'id': build.id,
|
||||||
|
'name': build.name,
|
||||||
|
'state': real_build.state,
|
||||||
|
'result': real_build.result,
|
||||||
|
'subject': build.subject,
|
||||||
|
'author': build.author,
|
||||||
|
'dest': build.dest,
|
||||||
|
'real_dest': real_build.dest,
|
||||||
|
'job_age': s2human(real_build.job_age),
|
||||||
|
'job_time': s2human(real_build.job_time),
|
||||||
|
'job': real_build.job,
|
||||||
|
'domain': real_build.domain,
|
||||||
|
'port': real_build.port,
|
||||||
|
'subject': build.subject,
|
||||||
|
}
|
||||||
|
|
||||||
def branch_info(branch):
|
def branch_info(branch):
|
||||||
return {
|
return {
|
||||||
'branch': branch,
|
'branch': branch,
|
||||||
'builds': [build_dict[build_id] for build_id in build_by_branch_ids[branch.id]]
|
'builds': [build_info(build_dict[build_id]) for build_id in build_by_branch_ids[branch.id]]
|
||||||
}
|
}
|
||||||
|
|
||||||
context.update({
|
context.update({
|
||||||
@ -955,18 +972,18 @@ class RunbotController(http.Controller):
|
|||||||
logging_ids = registry['ir.logging'].search(cr, uid, domain)
|
logging_ids = registry['ir.logging'].search(cr, uid, domain)
|
||||||
logs = registry['ir.logging'].browse(cr, uid, logging_ids)
|
logs = registry['ir.logging'].browse(cr, uid, logging_ids)
|
||||||
|
|
||||||
v = self.common(cr, uid)
|
context = self.common(cr, uid)
|
||||||
#v['type'] = type
|
#context['type'] = type
|
||||||
#v['level'] = level
|
#context['level'] = level
|
||||||
v['build'] = build
|
context['build'] = build
|
||||||
v['other_builds'] = other_builds
|
context['other_builds'] = other_builds
|
||||||
v['logs'] = logs
|
context['logs'] = logs
|
||||||
return request.render("runbot.build", v)
|
return request.render("runbot.build", context)
|
||||||
|
|
||||||
@http.route(['/runbot/build/<build_id>/force'], type='http', auth="public", website=True)
|
@http.route(['/runbot/build/<build_id>/force'], type='http', auth="public", website=True)
|
||||||
def build_force(self, build_id, **post):
|
def build_force(self, build_id, **post):
|
||||||
registry, cr, uid, context = request.registry, request.cr, 1, request.context
|
registry, cr, uid, context = request.registry, request.cr, 1, request.context
|
||||||
repo_id = registry['runbot.build'].force(cr, 1, [int(build_id)])
|
repo_id = registry['runbot.build'].force(cr, uid, [int(build_id)])
|
||||||
return werkzeug.utils.redirect('/runbot/repo/%s' % repo_id)
|
return werkzeug.utils.redirect('/runbot/repo/%s' % repo_id)
|
||||||
|
|
||||||
@http.route(['/runbot/build/<build_id>/label/<label_id>'], type='http', auth="public", method='POST')
|
@http.route(['/runbot/build/<build_id>/label/<label_id>'], type='http', auth="public", method='POST')
|
||||||
|
@ -208,50 +208,50 @@
|
|||||||
|
|
||||||
<!-- Templates -->
|
<!-- Templates -->
|
||||||
<template id="runbot.build_name">
|
<template id="runbot.build_name">
|
||||||
<t t-if="bu.state=='pending'"><i class="text-default fa fa-pause"/> pending</t>
|
<t t-if="bu['state']=='pending'"><i class="text-default fa fa-pause"/> pending</t>
|
||||||
<t t-if="bu.state=='testing'"><i class="text-info fa fa-spinner"/> testing <t t-esc="bu.job[4:]"/> <small><t t-esc="s2h(bu.job_time)"/></small></t>
|
<t t-if="bu['state']=='testing'"><i class="text-info fa fa-spinner"/> testing <t t-esc="bu['job']"/> <small><t t-esc="bu['job_time']"/></small></t>
|
||||||
<t t-if="bu.result=='ok'"><i class="text-success fa fa-thumbs-up"/><small> age <t t-esc="s2h(bu.job_age)"/> time <t t-esc="s2h(bu.job_time)"/></small></t>
|
<t t-if="bu['result']=='ok'"><i class="text-success fa fa-thumbs-up"/><small> age <t t-esc="bu['job_age']"/> time <t t-esc="bu['job_time']"/></small></t>
|
||||||
<t t-if="bu.result=='ko'"><i class="text-danger fa fa-thumbs-down"/><small> age <t t-esc="s2h(bu.job_age)"/> time <t t-esc="s2h(bu.job_time)"/></small></t>
|
<t t-if="bu['result']=='ko'"><i class="text-danger fa fa-thumbs-down"/><small> age <t t-esc="bu['job_age']"/> time <t t-esc="bu['job_time']"/></small></t>
|
||||||
<t t-if="bu.result=='warn'"><i class="text-warning fa fa-warning"/><small> age <t t-esc="s2h(bu.job_age)"/> time <t t-esc="s2h(bu.job_time)"/></small></t>
|
<t t-if="bu['result']=='warn'"><i class="text-warning fa fa-warning"/><small> age <t t-esc="bu['job_age']"/> time <t t-esc="bu['job_time']"/></small></t>
|
||||||
<t t-if="bu.result=='skipped'"><i class="text-danger fa fa-ban"/> skipped</t>
|
<t t-if="bu['result']=='skipped'"><i class="text-danger fa fa-ban"/> skipped</t>
|
||||||
<t t-if="bu.result=='killed'"><i class="text-danger fa fa-times"/> killed</t>
|
<t t-if="bu['result']=='killed'"><i class="text-danger fa fa-times"/> killed</t>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template id="runbot.build_button">
|
<template id="runbot.build_button">
|
||||||
<div t-attf-class="btn-group {{klass}} pull-right">
|
<div t-attf-class="btn-group {{klass}} pull-right">
|
||||||
<div t-attf-class="btn-group {{klass}}">
|
<div t-attf-class="btn-group {{klass}}">
|
||||||
<a t-if="bu.state=='running'" t-attf-href="http://{{bu.domain}}/?db={{bu.dest}}-all" class="btn btn-primary"><i class="fa fa-sign-in"/></a>
|
<a t-if="bu['state']=='running'" t-attf-href="http://{{bu['domain']}}/?db={{bu['dest']}}-all" class="btn btn-primary"><i class="fa fa-sign-in"/></a>
|
||||||
<a t-attf-href="/runbot/build/{{bu.id}}" class="btn btn-default"><i class="fa fa-file-text-o"/></a>
|
<a t-attf-href="/runbot/build/{{bu['id']}}" class="btn btn-default"><i class="fa fa-file-text-o"/></a>
|
||||||
<a t-attf-href="https://#{bu.repo_id.base}/commit/#{bu.name}" class="btn btn-default"><i class="fa fa-github"/></a>
|
<a t-attf-href="https://#{repo.base}/commit/#{bu['name']}" class="btn btn-default"><i class="fa fa-github"/></a>
|
||||||
<button class="btn btn-default dropdown-toggle" data-toggle="dropdown"><i class="fa fa-cog"/><span class="caret"></span></button>
|
<button class="btn btn-default dropdown-toggle" data-toggle="dropdown"><i class="fa fa-cog"/><span class="caret"></span></button>
|
||||||
<ul class="dropdown-menu" role="menu">
|
<ul class="dropdown-menu" role="menu">
|
||||||
<li t-if="bu.result=='skipped'">
|
<li t-if="bu['result']=='skipped'">
|
||||||
<a t-attf-href="/runbot/build/{{bu.id}}/force">Force Build<i class="fa fa-level-up"> </i></a>
|
<a t-attf-href="/runbot/build/{{bu['id']}}/force">Force Build<i class="fa fa-level-up"> </i></a>
|
||||||
</li>
|
</li>
|
||||||
<t t-if="bu.state=='running'">
|
<t t-if="bu['state']=='running'">
|
||||||
<li><a t-attf-href="http://{{bu.domain}}/?db={{bu.dest}}-all">Connect all <i class="fa fa-sign-in"></i></a></li>
|
<li><a t-attf-href="http://{{bu['domain']}}/?db={{bu['real_dest']}}-all">Connect all <i class="fa fa-sign-in"></i></a></li>
|
||||||
<li><a t-attf-href="http://{{bu.domain}}/?db={{bu.dest}}-base">Connect base <i class="fa fa-sign-in"></i></a></li>
|
<li><a t-attf-href="http://{{bu['domain']}}/?db={{bu['real_dest']}}-base">Connect base <i class="fa fa-sign-in"></i></a></li>
|
||||||
<li><a t-attf-href="http://{{bu.domain}}/">Connect <i class="fa fa-sign-in"></i></a></li>
|
<li><a t-attf-href="http://{{bu['domain']}}/">Connect <i class="fa fa-sign-in"></i></a></li>
|
||||||
</t>
|
</t>
|
||||||
<li t-if="bu.state in ['done','running'] and bu_index==0">
|
<li t-if="bu['state'] in ['done','running'] and bu_index==0">
|
||||||
<a t-attf-href="/runbot/build/#{bu.id}/force">Rebuild <i class="fa fa-refresh"/></a>
|
<a t-attf-href="/runbot/build/#{bu['id']}/force">Rebuild <i class="fa fa-refresh"/></a>
|
||||||
</li>
|
</li>
|
||||||
<li t-if="bu.state!='testing' and bu.state!='pending'" class="divider"></li>
|
<li t-if="bu['state']!='testing' and bu['state']!='pending'" class="divider"></li>
|
||||||
<li><a t-attf-href="/runbot/build/{{bu.id}}">Logs <i class="fa fa-file-text-o"/></a></li>
|
<li><a t-attf-href="/runbot/build/{{bu['id']}}">Logs <i class="fa fa-file-text-o"/></a></li>
|
||||||
<li><a t-attf-href="/runbot/static/build/#{bu.dest}/logs/job_10_test_base.txt">Full base logs <i class="fa fa-file-text-o"/></a></li>
|
<li><a t-attf-href="/runbot/static/build/#{bu['real_dest']}/logs/job_10_test_base.txt">Full base logs <i class="fa fa-file-text-o"/></a></li>
|
||||||
<li><a t-attf-href="/runbot/static/build/#{bu.dest}/logs/job_20_test_all.txt">Full all logs <i class="fa fa-file-text-o"/></a></li>
|
<li><a t-attf-href="/runbot/static/build/#{bu['real_dest']}/logs/job_20_test_all.txt">Full all logs <i class="fa fa-file-text-o"/></a></li>
|
||||||
<li t-if="bu.state!='pending'" class="divider"></li>
|
<li t-if="bu['state']!='pending'" class="divider"></li>
|
||||||
<li><a t-attf-href="{{bu.branch_id.branch_url}}">Branch or pull <i class="fa fa-github"/></a></li>
|
<li><a t-attf-href="{{br['branch'].branch_url}}">Branch or pull <i class="fa fa-github"/></a></li>
|
||||||
<li><a t-attf-href="https://{{bu.repo_id.base}}/commit/{{bu.name}}">Commit <i class="fa fa-github"/></a></li>
|
<li><a t-attf-href="https://{{repo.base}}/commit/{{bu['name']}}">Commit <i class="fa fa-github"/></a></li>
|
||||||
<li><a t-attf-href="https://{{bu.repo_id.base}}/compare/{{bu.branch_id.branch_name}}">Compare <i class="fa fa-github"/></a></li>
|
<li><a t-attf-href="https://{{repo.base}}/compare/{{br['branch'].branch_name}}">Compare <i class="fa fa-github"/></a></li>
|
||||||
<!-- TODO branch.pull from -->
|
<!-- TODO branch.pull from -->
|
||||||
<li class="divider"></li>
|
<li class="divider"></li>
|
||||||
<li><a t-attf-href="#" t-attf-onclick="$.post('/runbot/build/{{bu.id}}/label/1')">Toggle RDWIP label</a></li>
|
<li><a t-attf-href="#" t-attf-onclick="$.post('/runbot/build/{{bu['id']}}/label/1')">Toggle RDWIP label</a></li>
|
||||||
<li><a t-attf-href="#" t-attf-onclick="$.post('/runbot/build/{{bu.id}}/label/2')">Toggle OE label</a></li>
|
<li><a t-attf-href="#" t-attf-onclick="$.post('/runbot/build/{{bu['id']}}/label/2')">Toggle OE label</a></li>
|
||||||
<li class="divider"></li>
|
<li class="divider"></li>
|
||||||
<li class="disabled"><a href="#">Runtime: <t t-esc="bu.job_time"/>s</a></li>
|
<li class="disabled"><a href="#">Runtime: <t t-esc="bu['job_time']"/>s</a></li>
|
||||||
<li class="disabled"><a href="#">Port: <t t-esc="bu.port"/></a></li>
|
<li class="disabled"><a href="#">Port: <t t-esc="bu['port']"/></a></li>
|
||||||
<li class="disabled"><a href="#">Age: <t t-esc="s2h(bu.job_age)"/></a></li>
|
<li class="disabled"><a href="#">Age: <t t-esc="bu['job_age']"/></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -352,29 +352,29 @@
|
|||||||
<td>
|
<td>
|
||||||
<i t-if="br['branch'].sticky" class="fa fa-star"/>
|
<i t-if="br['branch'].sticky" class="fa fa-star"/>
|
||||||
<b t-esc="br['branch'].branch_name"/>
|
<b t-esc="br['branch'].branch_name"/>
|
||||||
<small><t t-esc="s2h(br['builds'][0].job_age)"/></small><br/>
|
<small><t t-esc="br['builds'][0]['job_age']"/></small><br/>
|
||||||
<div class="btn-group btn-group-xs">
|
<div class="btn-group btn-group-xs">
|
||||||
<a t-attf-href="{{br['branch'].branch_url}}" class="btn btn-default btn-xs">Branch or pull <i class="fa fa-github"/></a>
|
<a t-attf-href="{{br['branch'].branch_url}}" class="btn btn-default btn-xs">Branch or pull <i class="fa fa-github"/></a>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<t t-foreach="br['builds']" t-as="bu">
|
<t t-foreach="br['builds']" t-as="bu">
|
||||||
<t t-if="bu.state=='pending'"><t t-set="klass">default</t></t>
|
<t t-if="bu['state']=='pending'"><t t-set="klass">default</t></t>
|
||||||
<t t-if="bu.state=='testing'"><t t-set="klass">info</t></t>
|
<t t-if="bu['state']=='testing'"><t t-set="klass">info</t></t>
|
||||||
<t t-if="bu.state in ['running','done'] and bu.result == 'ko'"><t t-set="klass">danger</t></t>
|
<t t-if="bu['state'] in ['running','done'] and bu['result'] == 'ko'"><t t-set="klass">danger</t></t>
|
||||||
<t t-if="bu.state in ['running','done'] and bu.result == 'warn'"><t t-set="klass">warning</t></t>
|
<t t-if="bu['state'] in ['running','done'] and bu['result'] == 'warn'"><t t-set="klass">warning</t></t>
|
||||||
<t t-if="bu.state in ['running','done'] and bu.result == 'ok'"><t t-set="klass">success</t></t>
|
<t t-if="bu['state'] in ['running','done'] and bu['result'] == 'ok'"><t t-set="klass">success</t></t>
|
||||||
<t t-if="bu.state in ['running','done'] and bu.result == 'skipped'"><t t-set="klass">default</t></t>
|
<t t-if="bu['state'] in ['running','done'] and bu['result'] == 'skipped'"><t t-set="klass">default</t></t>
|
||||||
<t t-if="bu.state in ['running','done'] and bu.result == 'killed'"><t t-set="klass">killed</t></t>
|
<t t-if="bu['state'] in ['running','done'] and bu['result'] == 'killed'"><t t-set="klass">killed</t></t>
|
||||||
<td t-attf-class="{{klass}}">
|
<td t-attf-class="{{klass}}">
|
||||||
<t t-call="runbot.build_button"><t t-set="klass">btn-group-sm</t></t>
|
<t t-call="runbot.build_button"><t t-set="klass">btn-group-sm</t></t>
|
||||||
<t t-if="bu.subject">
|
<t t-if="bu['subject']">
|
||||||
<span t-esc="bu.subject[:32] + ('...' if bu.subject[32:] else '') " t-att-title="bu.subject"/>
|
<span t-esc="bu['subject'][:32] + ('...' if bu['subject'][32:] else '') " t-att-title="bu['subject']"/>
|
||||||
<br/>
|
<br/>
|
||||||
</t>
|
</t>
|
||||||
<t t-id="bu.author">
|
<t t-id="bu['author']">
|
||||||
<t t-esc="bu.author"/><br/>
|
<t t-esc="bu['author']"/><br/>
|
||||||
</t>
|
</t>
|
||||||
<small><t t-esc="bu.dest"/></small><br/>
|
<small><t t-esc="bu['dest']"/></small><br/>
|
||||||
<t t-call="runbot.build_name"/>
|
<t t-call="runbot.build_name"/>
|
||||||
</td>
|
</td>
|
||||||
</t>
|
</t>
|
||||||
|
Loading…
Reference in New Issue
Block a user