From b3532e022603aa5c038c69f12079dd1887f204ec Mon Sep 17 00:00:00 2001 From: =?utf8?q?Thibaut=20VAR=C3=88NE?= Date: Fri, 22 Jun 2018 15:25:47 +0200 Subject: [PATCH] phase1: add config option for shared workdir MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This patch adds a per-slave configuration option: shared_wd = This option defaults to False if unset, and should be set to True for slaves that share a single workdir among all workers. When it is True, expires.sh and cleanup.sh are disabled as the workdir housekeeping is entirely handled by the Git() step and the value of the 'do_cleanup' configuration option. expires.sh and cleanup.sh are unnecessary and potentially detrimental in this context. Signed-off-by: Thibaut VARÈNE --- phase1/master.cfg | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/phase1/master.cfg b/phase1/master.cfg index 09fed6a..62675f1 100644 --- a/phase1/master.cfg +++ b/phase1/master.cfg @@ -53,7 +53,7 @@ NetLocks = dict() for section in ini.sections(): if section.startswith("slave "): if ini.has_option(section, "name") and ini.has_option(section, "password"): - sl_props = { 'dl_lock':None, 'ul_lock':None, 'do_cleanup':False, 'max_builds':1 } + sl_props = { 'dl_lock':None, 'ul_lock':None, 'do_cleanup':False, 'max_builds':1, 'shared_wd':False } name = ini.get(section, "name") password = ini.get(section, "password") max_builds = 1 @@ -72,6 +72,11 @@ for section in ini.sections(): sl_props['ul_lock'] = lockname if lockname not in NetLocks: NetLocks[lockname] = locks.MasterLock(lockname) + if ini.has_option(section, "shared_wd"): + shared_wd = ini.getboolean(section, "shared_wd") + sl_props['shared_wd'] = shared_wd + if shared_wd and (max_builds != 1): + raise ValueError('max_builds must be 1 with shared workdir!') c['slaves'].append(BuildSlave(name, password, max_builds = max_builds, properties = sl_props)) # 'slavePortnum' defines the TCP port to listen on for connections from slaves. @@ -227,6 +232,9 @@ def IsMakeCleanRequested(pattern): return CheckCleanProperty def IsCleanupRequested(step): + shared_wd = step.getProperty("shared_wd") + if shared_wd: + return False do_cleanup = step.getProperty("do_cleanup") if do_cleanup: return True @@ -234,7 +242,11 @@ def IsCleanupRequested(step): return False def IsExpireRequested(step): - return not IsCleanupRequested(step) + shared_wd = step.getProperty("shared_wd") + if shared_wd: + return False + else: + return not IsCleanupRequested(step) def IsGitFreshRequested(step): do_cleanup = step.getProperty("do_cleanup") -- 2.30.2