1

I am new to BuildBot and trying to implement the build process from master.cfg.

I created common utility python packages which can be used while build-process,

So while adding steps in util.BuildFactory() I want to execute the python methods from my custom build-package.

I refereed the Adding customized functions to Buildbot.

I Imported my custom package in master.cfg in buildbot, But still not able to call that method directly from factory.addStep.

I have another alternative like create python script, import that custom-build utility package and then execute that script from steps.ShellCommand(command=['python', 'myScript.py'])

But there will be additional script maintains for particular build process and I can't reuse that script.

SO WHAT IS THE WAY TO CALL PYTHON METHOD FROM BUILD PROCESS OF BUILDBOT.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Dhairya
  • 743
  • 2
  • 11
  • 29

1 Answers1

2

To execute python code you need to write custom build step - a class inherited from BuildStep with your code in run() method. Note that this code will be executed on master (as and ShellCommand from question). To execute code on slave you need to use RemoteShellCommand. See docs for all details.

ayaye
  • 441
  • 2
  • 5
  • 1
    Thanks Ayaye for reply, can you please give me example of Custome Build Step, I am new to BuildBot. – Dhairya Feb 26 '18 at 13:09
  • 1
    @Dhairya please see buildbot's docs (the link is in my answer). 2.7.11.3 has build step example. At minimum it is a class inherited from steps.BuildStep with run method: class ShowReportStep(steps.BuildStep): @ defer.inlineCallbacks def run(self): // your python code here – ayaye Feb 27 '18 at 11:46
  • @ayaye I think that i need to call AddChanges as a step in my master.cfg. If I create a class that inherits from steps.Buildstep, how to I create an instance of the class and call the run method? – Man Wa kileleshwa Oct 11 '19 at 18:20