summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJo-Philipp Wich2019-07-16 17:12:29 +0000
committerJo-Philipp Wich2019-07-16 17:12:29 +0000
commitbb7b82b115ad53c48f26ac5641d4910ad501a202 (patch)
tree8655020750e2b9b37542e7e85590f48167061f0e
parent68ef7f89aa58e6d25f5cb585265ed8d5a3938875 (diff)
downloadbuildbot-bb7b82b115ad53c48f26ac5641d4910ad501a202.tar.gz
phase1: automatically setup shared work directory symlink
Until now, the shared work directory symlinks had to be provisioned manually, this commits automates the setup when work directory sharing is enabled for the slave. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
-rw-r--r--phase1/master.cfg18
1 files changed, 14 insertions, 4 deletions
diff --git a/phase1/master.cfg b/phase1/master.cfg
index a8abbc6..ff2f3e2 100644
--- a/phase1/master.cfg
+++ b/phase1/master.cfg
@@ -251,9 +251,11 @@ def IsMakeCleanRequested(pattern):
return CheckCleanProperty
+def IsSharedWorkdir(step):
+ return bool(step.getProperty("shared_wd"))
+
def IsCleanupRequested(step):
- shared_wd = step.getProperty("shared_wd")
- if shared_wd:
+ if IsSharedWorkdir(step):
return False
do_cleanup = step.getProperty("do_cleanup")
if do_cleanup:
@@ -262,8 +264,7 @@ def IsCleanupRequested(step):
return False
def IsExpireRequested(step):
- shared_wd = step.getProperty("shared_wd")
- if shared_wd:
+ if IsSharedWorkdir(step):
return False
else:
return not IsCleanupRequested(step)
@@ -464,6 +465,15 @@ for target in targets:
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(SetPropertyFromCommand(
name = "nproc",