Commit Graph

32 Commits

Author SHA1 Message Date
Xavier-Do
2b690de566 [IMP] runbot: allow to disable upgrade from a version 2024-11-12 08:33:14 +01:00
Xavier-Do
b96b32e8b9 [IMP] runbot: better docker logging
The docker operation are called often and cannot be logged each time.
If a docker operation is slow, we log it at the end but waiting for this
output we have no idea what the process is doing.

This pr proposed to go a lower level and get the stream from the docker
operation to be able to log earlier if we started a potentially slow
operation.
2024-09-11 13:16:13 +02:00
Christophe Monniez
d722160247 [IMP] drunbot: docker registry
The current runbot infrastructure has 100+ machine that will each build
all docker images.

This is unpractical for multiple reasons:
- impotant load on all machine when the build could be done once
- possible differences for the same image depending on the moment the
base was pulled on the host. An extreme example was the version of
python (3.11 or 3.12) when building the noble docker image before it was
stabilized.
- increase the chance to have a docker build failure in case of network
problem. (random)

A centralized registry will help with that, and allow future devlopment
to generate more docker images. All docker images will be exactly the
same, the pull time is faster than build time, only one build per docker
image, ...
2024-08-29 08:44:57 +02:00
Christophe Monniez
5fb0e2f5ab [FIX] runbot: avoid builder crash when no docker to build
When there is no Dockerfile marked as `to_build`, the runbot builder
crashes in loop trying to find the max of an empty sequence.

With this commit, the builder does not even try to build Dockerfile in
that case.
2024-08-26 11:04:54 +02:00
Xavier-Do
9c6124d645 [IMP] runbot: faster docker update after change 2024-08-08 15:11:34 +02:00
Xavier-Do
e5ad7c6242 [IMP] runbot: store docker build output in a dedicated model
When a docker fails to build, the output is logged in the chatter
leading to a lot of noise and a not so readable output. Moreover, the
output tries to format markdown and don't render line break correctly.

This commit proposes to introduce a model to store this output, as well
as some other info like the image identifier, build time, ...

This will help to compare images versions between hosts and should be
useful later to have multiple version of the same image with variant
once the docker registry is introduced.
2024-08-08 15:11:34 +02:00
Christophe Monniez
f26065c4dc [FIX] runbot: append a tuple in git gc command list 2024-02-21 07:57:18 +01:00
Xavier-Do
f7a1a6a11d [IMP] runbot: avoid long idle transaction
Git gc can last a few minutes, it's not a big deal since it's executed
once a day but the transaction is kept idele during this time wich is
not useful. This commit should help to avoid this.
2024-02-19 10:30:33 +01:00
Xavier-Do
b6bc0e3911 [IMP] runbot: allow to disable fetch on start 2024-02-05 12:00:28 +01:00
Xavier-Do
7bbd1271c6 [FIX] runbot: fix tools.py 2024-02-05 11:48:37 +01:00
Xavier-Do
e83db83533 [REL] runbot: adapt for 17.0 2024-01-30 10:50:58 +01:00
Xavier-Do
435ac449f5 [FIX] runbot: various fixes and ref
- clean thread username
- allow to write on params for debug (was mainly usefull to forbid it
at the beginning)
- imrpove some guidelines about method and actions naming/ ordering
- move some code for a cleaner organisation.
- remove some useless request.env.user (not useful anymore)
2023-09-25 10:52:16 +02:00
Xavier-Do
506ff03e07 [IMP] runbot: pause, and profile.
Pausing a host can be usefull in some case, mainly when testing new code
The loop will have no effect avoiding to break some build wainting for
testing.

Profile will help to identify potential performance flows during the
loop.
2023-06-30 10:54:50 +02:00
David James
7477b4cde9 [IMP] runbot_builder: support addons_path parameter
Currently, the addons_path is intuited from the location of the script, with the assumption that the only custom addons path will be runbot itself.

This commit introduces an addons_path parameter to support custom deployments. If the parameter is not set, the existing behaviour is unchanged.
2023-03-13 10:27:59 +01:00
Christophe Monniez
794a6bf7e2 [IMP] runbot: add a monitoring tool to the builder
At this moment it's difficult to monitor a build cpu and memory usage.
This must be done from outside the container to avoid to kill the cat by
opening the box.

This commit adds a daemonic thread launched by the builder. This thread
will read the memory and cpu stats of the running dockers and report
their stats in a log file into the logs directory of the builds.

The log file format is made to be easily mixed with the build logs and
spot memory leaks or cpu overload during builds.
2023-01-11 11:33:19 +01:00
Christophe Monniez
2cad0542f4 [IMP] runbot: queue build logs in a local database
Before the commit the build ir_logging was sent from the build instance
to the main runbot ir.logging table. As the number of runbot hosts
increases, it introduce a lot of concurrency.
e.g.: 80 hosts with 8 builds means 640 instances trying to insert
records in the ir.logging table.

With this commit, a special database is used on the builder host in
order to receive ir.logging's from the build instances.

Regulary, the table is emptied by the builder and the logs are inserted
in the runbot leader ir.logging table.
2022-11-28 06:46:49 +01:00
Christophe Monniez
d027d1c7de [IMP] runbot: git gc only once a day 2022-06-23 09:45:47 +02:00
Christophe Monniez
c006bf953d [FIX] runbot: apply small fixes 2022-06-20 14:37:02 +02:00
Christophe Monniez
250d48e266 [IMP] runbot: schedule git gc on repositories
On the actual runbot deployments, the `git gc` command is handled by a
unix cron. From time to time, some repositories get corrupted and we
suspect that some concurrent action may be involved as stated in
documentation [0].

For those reasons, with this commit, the `git gc` will be run by the
runbot clients themselves in order to avoid concurrent operations.

By default, the first gc will occur a few minutes after the start of the
client and the next gc are scheduled a two hours and a few minutes later.

Also, this commit ensures that the git config is written regularly in
case of change.

[0] https://git-scm.com/docs/git-gc
2022-06-20 10:32:10 +02:00
Xavier-Do
cbfc8401a8 [FIX] runbot: various FIX 2022-06-17 13:52:37 +02:00
Christophe Monniez
2f7c752793 [FIX] runbot: avoid hook_time update on builders 2022-02-10 13:39:18 +01:00
Xavier-Do
8cdb8c9e5b [FIX] runbot: small fixed to ease deployment 2022-01-27 10:08:39 +01:00
Xavier-Do
0b30b9c104 [IMP] runbot: create a separate process for cron
As for the builder, this give the ability to run the discovery of new
commits and all related logic in a separate process.

This will mainly be usefull to restart frontend without waiting for cron
or restart "leader" without stoping the frontend. This will also be
usefull for optimisation purpose.
2021-12-08 15:06:49 +01:00
Xavier-Do
45721cdf6c [IMP] runbot: runbot 5.0
Runbot initial architechture was working for a single odoo repo, and was
adapted to build enterprise. Addition of upgrade repo and test began
to make result less intuitive revealing more weakness of the system.

Adding to the oddities of duplicate detection and branch matching,
there was some room for improvement in the runbot models.

This (small) commit introduce the runbot v5.0, designed for a closer
match of odoo's development flows, and hopefully improving devs
experience and making runbot configuration more flexible.

**Remotes:** remote intoduction helps to detect duplicate between odoo and
odoo-dev repos: a commit is now on a repo, a repo having multiple remote.
If a hash is in odoo-dev, we consider that it is the same in odoo.
Note: github seems to manage commit kind of the same way. It is possible
to send a status on a commit on odoo when the commit only exists in
odoo-dev.
This change also allows to remove some repo duplicate configuration
between a repo and his dev corresponding repo.
(modules, server files, manifests, ...)

**Trigger:** before v5.0, only one build per repo was created, making it
difficult to tweak what test to execute in what case. The example use
case was for upgrade. We want to test upgrade to master when pushing on
odoo. But we also want to test upgrade the same way when pushing on
upgrade. We introduce a build that should be ran on pushing on either
repo when each repo already have specific tests.
The trigger allows to specify a build to create with a specific config.
The trigger is executed when any repo of the trigger repo is pushed.
The trigger can define depedencies: only build enterprise when pushing
enterprise, but enterprise needs odoo. Test upgrade to master when pushing
either odoo or upgrade.
Trigger will also allows to extract some build like cla that where
executed on both enterprise and odoo, and hidden in a subbuild.

**Bundle:** Cross repo branches/pr branches matching was hidden in build
creation and can be confusing. A build can be detected as a duplicate
of a pr, but not always if naming is wrong or traget is invalid/changes.
This was mainly because of how a community ref will be found. This was
making ci on pr undeterministic if duplicate matching fails. This was
also creating two build, with one pointing to the other when duplicate
detection was working, but the visual result can be confusing.
Associtaions of remotes and bundles fix this by adding all pr and
related branches from all repo in a bundle. First of all this helps to
visualise what the runbot consider has branch matching and that should
be considered as part of the same task, giving a place where to warn
devs of some possible inconsistencies. Associate whith repo/remote, we
can consider branches in the same repo in a bundle as expected to have
the same head. Only one build is created since trigger considers repo,
not remotes.

**Batch:** A batch is a group of build, a batch on a bundle can be
compared to a build on a branch in previous version. When a branch
is pushed, the corresponding bundle creates a new batch, and wait for
new commit. Once no new update are detected in the batch for 60 seconds,
All the trigger are executed if elligible. The created build are added
to the batch in a batch_slot. It is also possible that an corresponding
build exists (duplicate) and is added to the slot instead of creating a
new build.

Co-authored-by d-fence <moc@odoo.com>
2020-09-10 13:44:38 +02:00
Christophe Monniez
edda6c0265 [IMP] runbot: build docker image once per loop turn
At this moment, the Docker image is built at the beginning of each
runbot build. This blocks the _scheduler while the image is built.

With this commit, the image is built before calling the _scheduler and
is not linked to a runbot build.

Also, the necessary dirs are created in the static path before starting
the loop.
2020-01-22 13:50:01 +01:00
Xavier-Do
3ef33a5320 [FIX] runbot: clear environment, do not reset
Resetting env will make this env unusable with the new orm,
breaking field recomputes logic
2020-01-14 13:24:57 +01:00
Christophe Monniez
ff051b7ae0 [FIX] runbot: use a logging handler that loves logrotate
When the linux logrotate system rename the runbot logfile used by the
new builder script, the script continue to write in the reotated file.

With this commit, the WatchedFileHandler is used. This handler is
specialy crafted to handle this situation, it detects the file renaming
and automatically changes to the new file that have the old filename.
2020-01-07 09:46:55 +01:00
Christophe Monniez
f4ef66e029 [FIX] runbot: catch exceptions during main loop
* If an excpetion occurs during the main loop, the builder crashes. With
this commit, the main_loop is in a try/catch.

Also:

* remove unused imports
* move the first log after the Odoo import because Odoo changes the
  process timezone to UTC
2019-12-19 15:50:52 +01:00
Xavier-Do
328ba2d9c2 [IMP] runbot: adding some log 2019-12-18 17:37:06 +01:00
Xavier-Do
9ae816a23d [IMP] runbot: add some log 2019-12-18 17:27:33 +01:00
Xavier-Do
426b7af2cb [REF] runbot: refactor sheduler 2019-12-18 16:30:01 +01:00
Christophe Monniez
ae5f2906bf [REF] runbot: proof of concept standalone script
Actually, when deploying multiple instances of runbot, a full odoo
installation is needed.

With this commit, a single standalone (sort of) can be used to start a
runbot builder. It uses the same database as the runbot scheduler.
This script just reserve pending builds for himself and starts to build.

This is just a proof of concept. It should work alongside with a
standard runbot installation.
2019-12-18 16:30:01 +01:00