factory.addStep(ShellCommand(
name = "sharedwd",
description = "Setting up shared work directory",
- command = 'test -L "$PWD" || (mkdir -p "../shared-workdir" && rm -rf "$PWD" && ln -s shared-workdir "$PWD")',
+ command = 'test -L "$PWD" || (mkdir -p ../shared-workdir && rm -rf "$PWD" && ln -s shared-workdir "$PWD")',
workdir = ".",
haltOnFailure = True,
doStepIf = IsSharedWorkdir))
ini.has_option(section, "phase") and ini.getint(section, "phase") == 2:
name = ini.get(section, "name")
password = ini.get(section, "password")
+ sl_props = { 'shared_wd': False }
max_builds[name] = 1
+
if ini.has_option(section, "builds"):
max_builds[name] = ini.getint(section, "builds")
- c['slaves'].append(BuildSlave(name, password, max_builds = max_builds[name]))
+
+ if max_builds[name] == 1:
+ sl_props['shared_wd'] = True
+
+ if ini.has_option(section, "shared_wd"):
+ sl_props['shared_wd'] = ini.getboolean(section, "shared_wd")
+ if sl_props['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[name], properties = sl_props))
# 'slavePortnum' defines the TCP port to listen on for connections from slaves.
# This must match the value configured into the buildslaves (with their
return "{}\n{}".format(re.sub(r"\bsecret key$", "public key", comment),
base64.b64encode(seckey[0:2] + seckey[32:40] + seckey[72:]))
+def IsSharedWorkdir(step):
+ return bool(step.getProperty("shared_wd"))
+
c['builders'] = []
factory = BuildFactory()
+ # setup shared work directory if required
+ factory.addStep(ShellCommand(
+ name = "sharedwd",
+ description = "Setting up shared work directory",
+ command = 'test -L "$PWD" || (mkdir -p ../shared-workdir && rm -rf "$PWD" && ln -s shared-workdir "$PWD")',
+ workdir = ".",
+ haltOnFailure = True,
+ doStepIf = IsSharedWorkdir))
+
# find number of cores
factory.addStep(SetProperty(
name = "nproc",