Allow disabling build-log-retention

This allows setting build-log-retention to -1 to disable automatic
collection of logs.  This would facilitate managing these logs with an
external tool like logrotate.  Another case is where you have the
builds failing very quickly -- say, one of the builds has destroyed
the container and so builds fail to even exec dib correctly.  In this
case it's difficult to get to the root-cause of the problem because
the first build's logs (the one that destroyed the container) have
been repead just seconds after the failure.

Change-Id: I259c78e6a0e30b4c0a8d2f4c12a6941a2d227c38
This commit is contained in:
Ian Wienand 2020-04-28 13:17:13 +10:00
parent ec5e0909de
commit b9f6f6bf62
3 changed files with 8 additions and 1 deletions

View File

@ -83,7 +83,7 @@ Options
they exceed this value. This option specifies how many will be
kept (usually you will see one more, as deletion happens before
starting a new build). By default, the last 7 old build logs are
kept.
kept. Set this to ``-1`` to disable removal of logs.
.. attr:: zookeeper-servers
:type: list

View File

@ -592,6 +592,8 @@ class BuildWorker(BaseWorker):
return log_dir
def _pruneBuildLogs(self, name):
if self._config.build_log_retention < 0:
return
log_dir = self._getBuildLogRoot(name)
keep = max(self._config.build_log_retention, 1)
existing = sorted(os.listdir(log_dir))

View File

@ -0,0 +1,5 @@
---
features:
- |
Setting ``build-log-retention`` to ``-1`` will disable the removal of
old build logs.