mirror of
https://github.com/odoo/runbot.git
synced 2025-03-15 23:45:44 +07:00
[IMP] runbot: allow nginx access to tests dir
In order to stores other things than logs, that could be accessible by end users, for example screenshots and screencasts, a "tests" directory is allowed thruough the nginx template in the builds directories. Also, the "with" context manager is used to open the nginx configuration to ensure that the file descriptor is released during long running crons.
This commit is contained in:
parent
287efc7989
commit
c3e23532be
@ -499,7 +499,8 @@ class runbot_repo(models.Model):
|
||||
|
||||
nginx_config = self.env['ir.ui.view'].render_template("runbot.nginx_config", settings)
|
||||
os.makedirs(nginx_dir, exist_ok=True)
|
||||
open(os.path.join(nginx_dir, 'nginx.conf'), 'wb').write(nginx_config)
|
||||
with open(os.path.join(nginx_dir, 'nginx.conf'), 'wb') as nginx_file:
|
||||
nginx_file.write(nginx_config)
|
||||
try:
|
||||
_logger.debug('reload nginx')
|
||||
pid = int(open(os.path.join(nginx_dir, 'nginx.pid')).read().strip(' \n'))
|
||||
|
@ -39,7 +39,7 @@ server {
|
||||
location /runbot/static/ {
|
||||
alias <t t-esc="runbot_static"/>;
|
||||
autoindex off;
|
||||
location ~ /runbot/static/build/[^/]+/logs/ {
|
||||
location ~ /runbot/static/build/[^/]+/(logs|tests)/ {
|
||||
autoindex on;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user