mirror of
https://github.com/odoo/runbot.git
synced 2025-03-15 15:35:46 +07:00
[REM] runbot: remove runbot_domain
This parameter can be replaced by web.base.url when needed.
This commit is contained in:
parent
272096b810
commit
6b79d5b96c
11
README.md
11
README.md
@ -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.
|
||||
|
@ -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:
|
||||
|
@ -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)
|
||||
|
@ -140,50 +140,41 @@ 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?
|
||||
settings['builds'] = env['runbot.build'].search([('local_state', '=', 'running'), ('host', '=', fqdn())])
|
||||
|
||||
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)
|
||||
os.makedirs(nginx_dir, exist_ok=True)
|
||||
content = None
|
||||
nginx_conf_path = os.path.join(nginx_dir, 'nginx.conf')
|
||||
content = ''
|
||||
if os.path.isfile(nginx_conf_path):
|
||||
with open(nginx_conf_path, 'rb') as f:
|
||||
content = f.read()
|
||||
if content != nginx_config:
|
||||
_logger.info('reload nginx')
|
||||
with open(nginx_conf_path, 'wb') as f:
|
||||
f.write(nginx_config)
|
||||
try:
|
||||
pid = int(open(os.path.join(nginx_dir, 'nginx.pid')).read().strip(' \n'))
|
||||
os.kill(pid, signal.SIGHUP)
|
||||
except Exception:
|
||||
_logger.info('start nginx')
|
||||
if subprocess.call(['/usr/sbin/nginx', '-p', nginx_dir, '-c', 'nginx.conf']):
|
||||
# obscure nginx bug leaving orphan worker listening on nginx port
|
||||
if not subprocess.call(['pkill', '-f', '-P1', 'nginx: worker']):
|
||||
_logger.warning('failed to start nginx - orphan worker killed, retrying')
|
||||
subprocess.call(['/usr/sbin/nginx', '-p', nginx_dir, '-c', 'nginx.conf'])
|
||||
else:
|
||||
_logger.warning('failed to start nginx - failed to kill orphan worker - oh well')
|
||||
nginx_config = env['ir.ui.view']._render_template("runbot.nginx_config", settings)
|
||||
os.makedirs(nginx_dir, exist_ok=True)
|
||||
content = None
|
||||
nginx_conf_path = os.path.join(nginx_dir, 'nginx.conf')
|
||||
content = ''
|
||||
if os.path.isfile(nginx_conf_path):
|
||||
with open(nginx_conf_path, 'rb') as f:
|
||||
content = f.read()
|
||||
if content != nginx_config:
|
||||
_logger.info('reload nginx')
|
||||
with open(nginx_conf_path, 'wb') as f:
|
||||
f.write(nginx_config)
|
||||
try:
|
||||
pid = int(open(os.path.join(nginx_dir, 'nginx.pid')).read().strip(' \n'))
|
||||
os.kill(pid, signal.SIGHUP)
|
||||
except Exception:
|
||||
_logger.info('start nginx')
|
||||
if subprocess.call(['/usr/sbin/nginx', '-p', nginx_dir, '-c', 'nginx.conf']):
|
||||
# obscure nginx bug leaving orphan worker listening on nginx port
|
||||
if not subprocess.call(['pkill', '-f', '-P1', 'nginx: worker']):
|
||||
_logger.warning('failed to start nginx - orphan worker killed, retrying')
|
||||
subprocess.call(['/usr/sbin/nginx', '-p', nginx_dir, '-c', 'nginx.conf'])
|
||||
else:
|
||||
_logger.warning('failed to start nginx - failed to kill orphan worker - oh well')
|
||||
|
||||
def _get_cron_period(self):
|
||||
""" Compute a randomized cron period with a 2 min margin below
|
||||
|
@ -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;
|
||||
|
@ -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')
|
||||
|
||||
|
@ -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%;"/>
|
||||
|
Loading…
Reference in New Issue
Block a user