buildbot_travis icon indicating copy to clipboard operation
buildbot_travis copied to clipboard

How to set workerbuilddir?

Open baccenfutter opened this issue 7 years ago • 1 comments

For my builds to work, I need to leverage one of buildbot's features, namely customize the workerbuilddir. I am testing Ansible roles and the name of the directory has to be the name of the role in order for ansible to find the role in its role_path. However, the default workerbuilddir is build.

How do I set workerbuilddir in buildbot-travis?

baccenfutter avatar Apr 11 '18 08:04 baccenfutter

AFAIK, it is not included in Buildbot-travis yet. You can easily add the feature yourself in the code. In the class TravisSetupSteps of the module create_steps.py, you can add

workdir = self.build.getProperty("workdir", "")
if workdir:
	if isinstance(workdir, util.Interpolate):
		workdir = workdir.getRenderingFor(self.build).result
	workdir = self.workdir + '/' + workdir
else:
    workdir = self.workdir

and then add workdir in this statement:

step = ShellCommand(name=name, description=command, command=command, doStepIf=not self.disable)

so it looks like this:

 step = ShellCommand(name=name, description=command, command=command, doStepIf=not self.disable, workdir=workdir)

Once you have performed these changes, you'll be able to set your build directory in the environment variable of your .bbtravis.yml files:

env:
  global:
    - workdir=/path/to/your/workdir

vdsbenoit avatar Mar 19 '19 10:03 vdsbenoit