pythonpython-3.xdevopsbuildbot

Calling Python method in BuildBot build Steps


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.


Solution

  • 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.