Commit Graph

453 Commits

Author SHA1 Message Date
Julien Legros
f8cbae79e1
[FIX] runbot: nginx reload
Actually check the return code and do not raise any exception doing so.
2018-03-21 13:06:32 +01:00
Christophe Simonis
dc3659c6f1 [FIX] runbot: use connected user when logging kill/rebuild
As these methods are call in sudo mode, we should use request's user to
have a meaningful log entry.
2018-03-20 10:20:53 +01:00
Julien Legros
278d4ed449
[FIX] runbot: guess_result conversion to record api 2018-03-16 10:16:44 +01:00
Julien Legros
297d502afd
[FIX] runbot: adapt navbar view to v11 2018-03-15 13:38:02 +01:00
Julien Legros
3d71619dcd
[FIX] runbot: make repo_id stored again
Oversight of the code migration.
2018-03-14 16:02:08 +01:00
Julien Legros
328a25a31f
[FIX] runbot: do not rely on copy behavior for rebuilds
Instead of marking most fields as `copy=False` to be able to use the
copy method for rebuilds, we create the build explicitly. We also
forbid to copy builds as it doesn't make much sense to begin with.

As for duplicates, it wasn't always possible to rebuild them. The
rebuild now injects a specific context key (force_rebuild). This allows
duplicates to undergo a rebuild. The side-effect of writing on previous
builds is also removed[1].

[1]: it's not obvious from the diff but the porting to the V8 API
should have yielded

duplicate.write({'duplicate_id': build_id.id})

instead of

build_id.write({'duplicate_id': build_id.id})
2018-03-14 15:05:17 +01:00
Christophe Monniez
f5dcb7b371 [FIX] runbot_cla: fix enforce utf-8 even when runbot locale is different
The CLA md file must be encoded in UTF-8 but before this commit, the
file was opened with the locale of the system running the runbot. That
way, a UnicodeDecodeError was raised when the CLA was UTF-8 and not the
runbot locale was different. Leading to wrong validations.

This commit enforce UTF-8 encoding when opening the CLA's.
2018-03-14 11:07:55 +01:00
Christophe Simonis
9ff0e171e0 [FIX] runbot: resurrect badges 2018-03-13 18:14:15 +01:00
Christophe Monniez
e9a292373f [FIX] runbot: compute build time and don't copy from previous build
Before this commit, the job_end was always None because of a time2str
function with no return. So the job_time was the same as the job age.
Also, the result and times were copied from the prvious build. Displayed
time and results were wrong.
2018-03-13 16:38:20 +01:00
Julien Legros
1543c8d0d8 [FIX] runbot: allow rebuild and kill 2018-03-13 15:01:58 +01:00
Christophe Monniez
0b1ff4dd49 [FIX] runbot: add the dasboard view for sticky branches
During the runbot migration to Odoo 11.0, the dashboard was lost in
Limbo.
2018-03-13 11:15:39 +01:00
Christophe Monniez
5b8184890e [FIX] runbot: sync the build sequence with the build id
The branch order was wrong because of a zeroed build sequence.
2018-03-12 18:14:17 +01:00
Christophe Monniez
08beb51f2e [fix] runbot: make fast_launch find the last build 2018-03-12 17:49:35 +01:00
Christophe Monniez
4b0eac3b21 [FIX] runbot: compute repository url 2018-03-12 17:43:24 +01:00
Christophe Monniez
889df07bf6 [FIX] runbot: remove bad indentation 2018-03-12 16:59:35 +01:00
Christophe Monniez
bd715451a9 [FIX] runbot: allow webhooks to work 2018-03-12 15:39:44 +01:00
Christophe Monniez
21c31b4c3c [REF] runbot, runbot_cla: upgrade to Odoo 11.0
The previous code of runbot and runbot_cla was made for Odoo API version
8.0. This commit makes it work with Odoo API 11.0 and Python 3.

Also, the present refactoring splits the code into multiple files to
make it easier to read (I hope).

The main change due to Python 3 is the job locking mechanism:
Since PEP-446 file descriptors are non-inheritable by default.
A new method (os.set_inheritable) was introduced to explicitely make
fd inheritable. Also, the close_fds parameter of the subprocess.Popen
method is now True by default.

Finally, PEP-3151 changed the exception raised by fcntl.flock from IOError to OSError
(and IOError became an alias of OSError).

As a consequence of all that, the runbot locking mechanism to check if a
job is finished was not working in python3.
2018-03-12 14:36:33 +01:00
Christophe Monniez
e33881c9b4 [REF] README: update the readme file for the brand new repo 2018-03-08 16:59:39 +01:00
Christophe Simonis
c340e18506 [FIX] runbot: force lowercase build dest (used as dbname prefix) 2018-02-07 16:00:28 +01:00
Christophe Monniez
966e12ee71 [FIX] runbot: add dependency on base_setup
To install properly, Runbot needs to find base.menu_config which is
defined in base_setup res_config_view.
2017-11-20 11:14:54 +01:00
Christophe Simonis
0c3c8a0b75 [FIX] runbot: init method may not exists on parent class 2017-11-14 16:58:56 +01:00
Christophe Simonis
cdf4cd8287 [IMP] runbot: allow to rebuild deathrow builds 2017-09-28 15:06:47 +02:00
Christophe Simonis
c322a10ccc [IMP] runbot: guess future result of testing build 2017-09-21 18:24:44 +02:00
Christophe Simonis
03da1e9339 [IMP] runbot: automatically link logs to build
The linked build is extracted from dbname via a trigger on new row
creation.

This improve rendering of build page.

A migration script is added to link existing logging entries to
corresponding build and remove invalid ones.
Note that this migration script can take a long time.
2017-09-21 17:44:32 +02:00
Christophe Simonis
eb267ffa44 [FIX] runbot: correct redirect url 2017-09-18 13:41:08 +02:00
Christophe Simonis
e265607b3f [FIX] runbot: correct logging in method _ask_kill 2017-09-18 13:35:43 +02:00
Christophe Simonis
54f3cb9488 [FIX] runbot: force integer build ids in routes 2017-09-18 13:27:27 +02:00
Denis Vermylen
fb1e1dfd53 [IMP] runbot: add kill button (+ deathrow state)
Allow logged users to kill builds that are pending or testing.

The kill button solves the following problem:

When you have a community and enterprise branch with pull request.
The enterprise PR gets fetched before the branch by runbot, so it
builds with the community master branch instead of the corresponding
community branch. As the branch shares the same HEAD as the PR,
so no other build is done for the branch.

Previously you had to wait the build to finish building, then rebuild it
from the branch, taking twice the time necessary. Now you'll be able to
kill & rebuild it just after pushing the branch.

Also having a kill button is globally a nice to have feature.
2017-09-18 12:43:02 +02:00
Denis Vermylen
a3d30e9d3c [IMP] runbot: keep search query upon rebuild 2017-09-18 12:43:02 +02:00
Christophe Simonis
ba77916247 [IMP] runbot: index logging entries per build 2017-09-06 11:53:36 +02:00
Christophe Simonis
2ad4274157 [FIX] runbot: respect shebang 2017-09-05 16:43:14 +02:00
Дмитро Катюха
9ad2164d99 runbot: res_config, replace tabs with spaces 2017-08-09 17:32:40 +02:00
Дмитро Катюха
4c5f5105cd runbot: fixed mistake in nginx config templatew 2017-08-09 17:32:40 +02:00
Christophe Simonis
ca8bc51180 [IMP] runbot: more color in build page 2017-07-12 16:30:08 +02:00
Christophe Simonis
81ce2354f6 [FIX] runbot: more verbose logs 2017-07-12 12:26:20 +02:00
Christophe Simonis
26b3820b9e [IMP] runbot: nginx config: specify error log 2017-06-30 12:01:38 +02:00
Christophe Simonis
f22ca0d212 [FIX] runbot: escape server name in nginx config 2017-06-30 12:00:19 +02:00
Christophe Simonis
3339d20520 [FIX] runbot: limit rebuild to runbot users 2017-06-16 14:22:27 +02:00
Ludovic Laffineur lla
301f747634 [ADD] runbot: add coverage link in the build button 2017-06-15 14:44:49 +02:00
Christophe Simonis
447a19882e [FIX] runbot: log who initiate rebuilds 2017-06-15 14:37:32 +02:00
Denis Ledoux
1d69f1e368 [FIX] runbot: more accurate search for duplicates
In a repository with dependencies
e.g. `odoo-dev/enterprise` depending on `odoo-dev/odoo`
consider a build as a duplicate of another if
 - The HEAD is identical (as before)
 - AND the branches used for the depending repositories are the same

e.g.
 - pushing `master-staging-dle` to `odoo-dev/enterprise`,
 - with as HEAD the same HEAD than `master`,
 - but for which a branch `master-staging-dle` exists in `odoo-dev/odoo`
 - a duplicate would be a build having as HEAD the HEAD of master
   AND the `odoo-dev` branch `master-staging-dle`

Before, it would have used the latest build of the `master` branch,
as the HEAD was the same, despite the fact it didn't use the branch
`master-staging-dle` of `odoo-dev/odoo`
2017-05-18 17:07:35 +02:00
Olivier Dony
8dfee8af40 [FIX] runbot: stop forcing git gc --auto during updates
The `git gc --auto` command often fails and requires an explicit
execution of `git gc --prune=all`. When it happens, it crashes the
update, failing the cron execution.

Executing `git gc prune` every time would be very slow and dispruptive
during the cron's critical sections.

As the initial goal was to avoid triggering the automatic GC during the
next update/pull command, we prefer to adopt the global strategy of
disabling the auto GC globally with:

  git config --global gc.auto 0

And to configure a system cron job to periodically GC/prune all
repositories, to get the performance benefit.
Due to locking issues, that cronjob should be scheduled outside peak
build hours.

Example bash script for the system cron:

```
   #!/bin/bash
   set -e
   base_repo_dir='/path/to/runbot/static/repo'

   for repo in $base_repo_dir/*
   do
       if [[ -d $repo ]];then
           git --git-dir="$repo" gc --prune=all
       fi
   done
```
2017-05-16 11:00:01 +02:00
Christophe Simonis
a5b88ff0ab [FIX] runbot: failing to update a repo should not stop others 2017-05-05 11:38:08 +02:00
Olivier Dony
99c200afcb [FIX] runbot: recover from failed job method call
Catch exceptions occurring within job methods, to avoid
stalling the runbot by repeatedly trying to call it -
and crashing every time.

Mark the build as failed immediately and skip it.
2017-05-02 14:32:13 +02:00
Olivier Dony
1d46bf9ff5 [FIX] runbot: stop wasting a cycle for coverage check
Build jobs that return a -2 PID are considered immediately done and the
next job is started without waiting for a cron cycle.
2017-05-02 13:25:42 +02:00
Olivier Dony
63b997a4ed [FIX] runbot: make checkout safer wrt addons layout
Avoid errors/crash when the server/addons directory in the build branch
contains symlinks.

Exhibited by e.g. odoo/odoo#16720
2017-05-02 13:07:02 +02:00
Christophe Simonis
f889f2095c [IMP] runbot: let nginx serve static files 2017-04-27 16:43:48 +02:00
Olivier Dony
d66047230b [FIX] runbot*: make most methods private
Most of the non-CRUD methods of runbot models should be private, as
there is no need to access them via RPC.

WARNING: This change is backwards compatible with existing
installations and existing runbot databases, but will most
likely BREAK all third-party extensions, due to the renamed
methods.

Fortunately the runbot module is not ruled by Odoo's "stable policy" ;-)

Reported by @nilshamerlinck - thanks!
2017-04-27 14:54:39 +02:00
Olivier Dony
e1ecb49f89 [FIX] runbot: use proper manager visibility
The token is not meant to be used by anyone except runbot managers.

Reported by @nilshamerlinck - thanks!
2017-04-27 14:54:39 +02:00
Christophe Simonis
3b1145b4ab [IMP] runbot: ignore pad modules 2017-03-10 11:56:23 +01:00