[REM] runbot: remove runbot_domain

This parameter can be replaced by web.base.url when needed.
This commit is contained in:
Xavier-Do 2022-06-07 10:54:48 +02:00
parent 272096b810
commit 6b79d5b96c
7 changed files with 36 additions and 59 deletions

View File

@ -76,8 +76,18 @@ Note:
- --limit-time-real-cron is important to ensure that cron has enough time to build docker images and clone repos the first time. It may be reduced to a lower value later (600 is advised).
- --limit-memory-* is not mandatory, but fetching odoo on multiple remote with only 2Gib may result in a failure of the fetch command. If git fails to create async thread or run out of memory, increasing memory limit may be a good idea. *cf. odoo-bin --help for more info.*
This is an example command line, starting runbot in worker mode is advised.
You may want to configure a service or launch odoo in a screen depending on your preferences.
You also may need to configure nginx depending on your preferences
```
server {
listen 443 default;
location / { proxy_pass http://127.0.0.1:8069; }
...
}
```
### Configuration
*Note: Runbot is optimized to run commit discovery and build scheduling on different hosts to allow load share on different machines. This basic configuration will show how to run runbot on a single machine, a less-tested use case*
@ -137,7 +147,6 @@ Acces the runbot settings and tweak the default parameters.
- The *number of worker* is the default number of parallel testing builds per machine. It is advised to keep one physical core per worker on a dedicated machine. On a local machine,keep it low, **2** is a good start (using 8 on runbot.odoo.com).
- The *number of running build* is the number of parallel running builds. Runbot will start to kill running builds once this limit is reached. This number can be pumped up on a server (using 60 on runbot.odoo.com).
- *Runbot domain* will mainly be used for nginx to access running builds.
- Max commit age is the limit after which a branch head will be ignored in processing. This will reduce the processing of old non deleted branches. Keep in mind that pushing an old commit on a branch will also be ignored by runbot.
- **Discover new commits** is disabled by default but is needed to fetch repositories and create new commits/batches/builds. **Check** this option.

View File

@ -1166,8 +1166,7 @@ class BuildResult(models.Model):
_logger.info("skipping github status for build %s ", build.id)
continue
runbot_domain = self.env['runbot.runbot']._domain()
target_url = trigger.ci_url or "http://%s/runbot/build/%s" % (runbot_domain, build.id)
target_url = trigger.ci_url or "%s/runbot/build/%s" % (self.get_base_url(), build.id)
for build_commit in self.params_id.commit_link_ids:
commit = build_commit.commit_id
if 'base_' not in build_commit.match_type and commit.repo_id in trigger.repo_ids:

View File

@ -15,7 +15,6 @@ class ResConfigSettings(models.TransientModel):
runbot_running_max = fields.Integer('Maximum number of running builds')
runbot_timeout = fields.Integer('Max allowed step timeout (in seconds)')
runbot_starting_port = fields.Integer('Starting port for running builds')
runbot_domain = fields.Char('Runbot domain')
runbot_max_age = fields.Integer('Max commit age (in days)')
runbot_logdb_uri = fields.Char('Runbot URI for build logs')
runbot_update_frequency = fields.Integer('Update frequency (in seconds)')
@ -47,7 +46,6 @@ class ResConfigSettings(models.TransientModel):
runbot_running_max=int(get_param('runbot.runbot_running_max', default=5)),
runbot_timeout=int(get_param('runbot.runbot_timeout', default=10000)),
runbot_starting_port=int(get_param('runbot.runbot_starting_port', default=2000)),
runbot_domain=get_param('runbot.runbot_domain', default=common.fqdn()),
runbot_max_age=int(get_param('runbot.runbot_max_age', default=30)),
runbot_logdb_uri=get_param('runbot.runbot_logdb_uri', default=False),
runbot_update_frequency=int(get_param('runbot.runbot_update_frequency', default=10)),
@ -67,7 +65,6 @@ class ResConfigSettings(models.TransientModel):
set_param("runbot.runbot_running_max", self.runbot_running_max)
set_param("runbot.runbot_timeout", self.runbot_timeout)
set_param("runbot.runbot_starting_port", self.runbot_starting_port)
set_param("runbot.runbot_domain", self.runbot_domain)
set_param("runbot.runbot_max_age", self.runbot_max_age)
set_param("runbot.runbot_logdb_uri", self.runbot_logdb_uri)
set_param('runbot.runbot_update_frequency', self.runbot_update_frequency)

View File

@ -140,24 +140,15 @@ class Runbot(models.AbstractModel):
self.env.cr.execute(query, [host.name] + select_params + [nb_slots])
return self.env.cr.fetchall()
def _domain(self):
return self.env.get('ir.config_parameter').sudo().get_param('runbot.runbot_domain', fqdn())
def _reload_nginx(self):
env = self.env
settings = {}
settings['port'] = config.get('http_port')
settings['runbot_domain'] = self._domain()
settings['runbot_static'] = os.path.join(get_module_resource('runbot', 'static'), '')
nginx_dir = os.path.join(self._root(), 'nginx')
settings['nginx_dir'] = nginx_dir
settings['re_escape'] = re.escape
settings['fqdn'] = fqdn()
icp = env['ir.config_parameter'].sudo()
nginx = icp.get_param('runbot.runbot_nginx', True) # or just force nginx?
if nginx:
settings['builds'] = env['runbot.build'].search([('local_state', '=', 'running'), ('host', '=', fqdn())])
nginx_config = env['ir.ui.view']._render_template("runbot.nginx_config", settings)

View File

@ -37,20 +37,6 @@ proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Proto $real_scheme;
proxy_set_header Host $host;
server {
listen 8080 default;
location / { proxy_pass http://127.0.0.1:<t t-esc="port"/>; }
location /longpolling/im/poll { return 404; }
location /longpolling/poll { return 404; }
location /runbot/static/ {
alias <t t-esc="runbot_static"/>;
autoindex off;
location ~ /runbot/static/build/[^/]+/(logs|tests)/ {
autoindex on;
add_header 'Access-Control-Allow-Origin' 'https://<t t-esc="runbot_domain"/>';
}
}
}
<t t-foreach="builds" t-as="build">
server {
listen 8080;

View File

@ -161,11 +161,8 @@ class TestBuildResult(RunbotCase):
self.assertEqual(build.dest, '%05d-13-0' % build.id)
# Test domain compute with fqdn and ir.config_parameter
self.env['ir.config_parameter'].sudo().set_param('runbot.runbot_nginx', False)
self.patchers['fqdn_patcher'].return_value = 'runbot98.nowhere.org'
self.env['ir.config_parameter'].sudo().set_param('runbot.runbot_domain', False)
self.assertEqual(build.domain, 'runbot98.nowhere.org:1234')
self.env['ir.config_parameter'].set_param('runbot.runbot_domain', 'runbot99.example.org')
build._compute_domain()
self.assertEqual(build.domain, 'runbot99.example.org:1234')

View File

@ -46,8 +46,6 @@
<div class="content-group">
<label for="runbot_do_schedule" class="col-xs-3 o_light_label" style="width: 40%;"/>
<field name="runbot_do_schedule"/>
<label for="runbot_domain" class="col-xs-3 o_light_label" style="width: 40%;"/>
<field name="runbot_domain" style="width: 55%;"/>
<label for="runbot_template" class="col-xs-3 o_light_label" style="width: 40%;"/>
<field name="runbot_template" style="width: 55%;"/>
<label for="runbot_is_base_regex" class="col-xs-3 o_light_label" style="width: 40%;"/>