[IMP] runbot: adapt for odoo 15.0

This commit is contained in:
Xavier-Do 2022-03-18 15:53:49 +01:00 committed by xdo
parent 78f050b132
commit 3071f5a6db
15 changed files with 31 additions and 34 deletions

View File

@ -1,2 +1,2 @@
matplotlib==3.1.2
matplotlib==3.5.0
unidiff

View File

@ -36,8 +36,6 @@
'templates/nginx.xml',
'templates/build_error.xml',
'views/assets.xml',
'views/branch_views.xml',
'views/build_error_views.xml',
'views/build_views.xml',
@ -59,4 +57,11 @@
'views/menus.xml',
],
'license': 'LGPL-3',
'assets': {
'web.assets_backend': [
'runbot/static/src/js/json_field.js',
],
}
}

View File

@ -53,7 +53,7 @@ def route(routes, **kw):
response.qcontext['current_path'] = request.httprequest.full_path
response.qcontext['refresh'] = refresh
response.qcontext['filter_mode'] = filter_mode
response.qcontext['default_category'] = request.env['ir.model.data'].xmlid_to_res_id('runbot.default_category')
response.qcontext['default_category'] = request.env['ir.model.data']._xmlid_to_res_id('runbot.default_category')
response.qcontext['qu'] = QueryURL('/runbot/%s' % (slug(project)), path_args=['search'], search=search, refresh=refresh)
if 'title' not in response.qcontext:
response.qcontext['title'] = 'Runbot %s' % project.name or ''
@ -152,7 +152,7 @@ class Runbot(Controller):
query.limit=40
bundles = env['runbot.bundle'].browse(query)
category_id = int(request.httprequest.cookies.get('category') or 0) or request.env['ir.model.data'].xmlid_to_res_id('runbot.default_category')
category_id = int(request.httprequest.cookies.get('category') or 0) or request.env['ir.model.data']._xmlid_to_res_id('runbot.default_category')
trigger_display = request.httprequest.cookies.get('trigger_display_%s' % project.id, None)
if trigger_display is not None:

View File

@ -154,9 +154,9 @@ class BuildResult(models.Model):
trigger_id = fields.Many2one('runbot.trigger', related='params_id.trigger_id', store=True, index=True)
# state machine
global_state = fields.Selection(make_selection(state_order), string='Status', compute='_compute_global_state', store=True)
global_state = fields.Selection(make_selection(state_order), string='Status', compute='_compute_global_state', store=True, recursive=True)
local_state = fields.Selection(make_selection(state_order), string='Build Status', default='pending', required=True, index=True)
global_result = fields.Selection(make_selection(result_order), string='Result', compute='_compute_global_result', store=True)
global_result = fields.Selection(make_selection(result_order), string='Result', compute='_compute_global_result', store=True, recursive=True)
local_result = fields.Selection(make_selection(result_order), string='Build Result')
triggered_result = fields.Selection(make_selection(result_order), string='Triggered Result') # triggered by db only

View File

@ -35,7 +35,7 @@ class Bundle(models.Model):
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)
version_id = fields.Many2one('runbot.version', 'Version', compute='_compute_version_id', store=True)
version_id = fields.Many2one('runbot.version', 'Version', compute='_compute_version_id', store=True, recursive=True)
version_number = fields.Char(related='version_id.number', store=True, index=True)
previous_major_version_base_id = fields.Many2one('runbot.bundle', 'Previous base bundle', compute='_compute_relations_base_id')
@ -129,7 +129,7 @@ class Bundle(models.Model):
def _compute_last_batchs(self):
batch_ids = defaultdict(list)
if self.ids:
category_id = self.env.context.get('category_id', self.env['ir.model.data'].xmlid_to_res_id('runbot.default_category'))
category_id = self.env.context.get('category_id', self.env['ir.model.data']._xmlid_to_res_id('runbot.default_category'))
self.env.cr.execute("""
SELECT
id
@ -161,7 +161,7 @@ class Bundle(models.Model):
# self.env['runbot.batch'].flush()
for bundle in self:
bundle.last_done_batch = False
category_id = self.env.context.get('category_id', self.env['ir.model.data'].xmlid_to_res_id('runbot.default_category'))
category_id = self.env.context.get('category_id', self.env['ir.model.data']._xmlid_to_res_id('runbot.default_category'))
self.env.cr.execute("""
SELECT
id

View File

@ -37,7 +37,7 @@ class Dockerfile(models.Model):
def _compute_dockerfile(self):
for rec in self:
try:
res = rec.template_id._render().decode() if rec.template_id else ''
res = rec.template_id._render() if rec.template_id else ''
rec.dockerfile = re.sub(r'^\s*$', '', res, flags=re.M).strip()
except QWebException:
rec.dockerfile = ''

View File

@ -117,6 +117,6 @@ access_runbot_codeowner_user,runbot_codeowner_user,runbot.model_runbot_codeowner
access_runbot_commit_export_admin,runbot_commit_export_admin,runbot.model_runbot_commit_export,runbot.group_runbot_admin,1,1,1,1
access_runbot_trigger_custom_wizard,access_runbot_trigger_custom_wizard,model_runbot_trigger_custom_wizard,runbot.group_runbot_admin,1,1,1,1
access_runbot_trigger_custom_wizard,access_runbot_trigger_custom_wizard,model_runbot_trigger_custom_wizard,runbot.group_runbot_admin,1,1,1,1
access_runbot_build_stat_regex_wizard,access_runbot_build_stat_regex_wizard,model_runbot_build_stat_regex_wizard,runbot.group_runbot_admin,1,1,1,1
access_runbot_build_stat_regex_wizard,access_runbot_build_stat_regex_wizard,model_runbot_build_stat_regex_wizard,runbot.group_runbot_admin,1,1,1,1

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
117
118
119
120
121
122

View File

@ -143,7 +143,7 @@
<div t-attf-class="alert alert-{{logclass}}">
<b t-esc="log.level"/>
--
<t t-raw="log._markdown()"/>
<t t-out="log._markdown()"/>
</div>
</t>
</t>

View File

@ -87,7 +87,7 @@
<t t-if="build.description">
<b>Description:</b>
<t t-raw="build.md_description"/>
<t t-out="build.md_description"/>
<br/>
</t>
@ -184,7 +184,7 @@
<t t-esc="child.id"/>
</a>
<t t-if="child.description">
<t t-raw="child.md_description" />
<t t-out="child.md_description" />
</t>
<t t-else="">
with config
@ -283,7 +283,7 @@
<t t-esc="message[2]"/>
</t>
</t>
<t t-elif="l.type == 'markdown'" t-raw="l._markdown()"/>
<t t-elif="l.type == 'markdown'" t-out="l._markdown()"/>
<t t-else="">
<t t-if="'\n' not in l.message" t-esc="l.message"/>
<pre t-if="'\n' in l.message" style="margin:0;padding:0; border: none;"><t t-esc="l.message"/></pre>
@ -352,7 +352,7 @@
</td>
<td>
<t t-if="build.description">
<t t-raw="build.md_description" />
<t t-out="build.md_description" />
</t>
</td>
<td>

View File

@ -11,7 +11,7 @@
<b>Build: </b><a t-attf-href="/runbot/build/{{build.id}}"><t t-esc="build.id"/></a><br/>
<t t-if="build.description">
<b>Description:</b>
<t t-raw="build.md_description"/>
<t t-out="build.md_description"/>
<br/>
</t>
<b>Date: </b><t t-esc="build.create_date" /><br/>

View File

@ -135,7 +135,7 @@ RUN <t t-esc="values['python_version']"/> -m pip install --no-cache-dir setuptoo
<t t-call="runbot.docker_install_debs">
<t t-set="deb_packages" t-value="values['deb_packages_python']"/>
</t>
<t t-raw="0"/><!-- custom content from caller t-call-->
<t t-out="0"/><!-- custom content from caller t-call-->
<t t-call="runbot.docker_install_wkhtml"/>
<t t-call="runbot.docker_install_nodejs"/>
<t t-call="runbot.docker_install_node_packages"/>

View File

@ -54,14 +54,14 @@ server {
<t t-foreach="builds" t-as="build">
server {
listen 8080;
server_name ~^<t t-raw="re_escape(build.dest)"/>(-[a-z0-9_]+)?\.<t t-raw="re_escape(fqdn)"/>$;
server_name ~^<t t-out="re_escape(build.dest)"/>(-[a-z0-9_]+)?\.<t t-esc="re_escape(fqdn)"/>$;
location / { proxy_pass http://127.0.0.1:<t t-esc="build.port"/>; }
location /longpolling { proxy_pass http://127.0.0.1:<t t-esc="build.port + 1"/>; }
}
</t>
server {
listen 8080;
server_name ~.+\.<t t-raw="re_escape(fqdn)"/>$;
server_name ~.+\.<t t-out="re_escape(fqdn)"/>$;
location / { return 404; }
}
}

View File

@ -23,7 +23,7 @@
</head>
<body>
<t t-raw="0"/>
<t t-out="0"/>
</body>
</html>
</template>
@ -126,12 +126,12 @@
</li>
</t>
</ul>
<t t-raw="nav_form or ''">
<t t-out="nav_form or ''">
</t>
</div>
</nav>
</header>
<t t-raw="0"/>
<t t-out="0"/>
</body>
</xpath>
</template>

View File

@ -1,7 +0,0 @@
<odoo>
<template id="runbot_json_field" inherit_id="web.assets_backend" active="True">
<xpath expr="." position="inside">
<script type="text/javascript" src="/runbot/static/src/js/json_field.js"></script>
</xpath>
</template>
</odoo>

View File

@ -311,7 +311,7 @@
<h3 t-if="not entry_first" t-esc="entry"/>
<ul>
<li t-foreach="sorted(entry_value)" t-as="item">
<t t-raw="item"/>
<t t-out="item"/>
</li>
</ul>
</section>
@ -436,4 +436,3 @@
</t>
</template>
</odoo>