From: Thibaut VARÈNE Date: Fri, 22 Jun 2018 13:25:47 +0000 (+0200) Subject: phase1: add config option for shared workdir X-Git-Tag: v1~138 X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=b3532e022603aa5c038c69f12079dd1887f204ec;p=buildbot.git phase1: add config option for shared workdir 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 --- 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")