runbot/runbot_builder/builder.py
Xavier-Do 63d1fb5cd6 [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-06 09:39:08 +02:00

39 lines
1.2 KiB
Python
Executable File

#!/usr/bin/python3
import logging
import threading
from pathlib import Path
from tools import RunbotClient, run, docker_monitoring_loop
_logger = logging.getLogger(__name__)
class BuilderClient(RunbotClient):
def on_start(self):
builds_path = self.env['runbot.runbot']._path('build')
monitoring_thread = threading.Thread(target=docker_monitoring_loop, args=(builds_path,), daemon=True)
monitoring_thread.start()
if self.env['ir.config_parameter'].sudo().get_param('runbot.runbot_do_fetch'):
for repo in self.env['runbot.repo'].search([('mode', '!=', 'disabled')]):
repo._update(force=True)
def loop_turn(self):
if self.count == 1: # cleanup at second iteration
self.env['runbot.runbot']._source_cleanup()
self.env['runbot.build']._local_cleanup()
self.env['runbot.runbot']._docker_cleanup()
self.host._set_psql_conn_count()
self.host._docker_build()
self.env['runbot.repo']._update_git_config()
self.env.cr.commit()
self.git_gc()
self.env.cr.commit()
return self.env['runbot.runbot']._scheduler_loop_turn(self.host)
if __name__ == '__main__':
run(BuilderClient)