向Buildbot添加自定义功能 [英] Adding customized functions to Buildbot

查看:97
本文介绍了向Buildbot添加自定义功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经用python编写了一个函数,当它收到 build命令时,我想让Buildbot执行该函数
。我之前曾使用 factory.addStep()通过命令行添加新命令,但不确定如何向Buildbot添加python函数。谢谢,请让我知道我是否不清楚。

I have written a function in python and I would like to have Buildbot to execute this function when it receives a "build" command. I have used the "factory.addStep()" before to add new commands through command line, but I'm not sure how I can add a python function to Buildbot. Thanks and please let me know if I'm being unclear on anything.

推荐答案

您是否要在主服务器或从服务器上运行代码?

Do you want the code to run on the master or the slave?

如果要在主数据库上运行代码,则只需做一个子类 BuildStep ,然后将代码放入(请参见vernomcrp的答案中的链接)。

If you want to run code on the master, then all you need to do is subclass BuildStep, and put your code in .start (see the link in vernomcrp's answer).

如果要在从属服务器上运行代码,事情会变得棘手。最简单的解决方案是是否可以编写python脚本(而不是函数)并执行该脚本。您可以将脚本包含在存储库中,或者使用 FileDownload StringDownload

If you want to run the code on the slave, things become trickier. The simplest solution is if you can write a python script (rather than function), and execute that script. You can include the script in your repository, or download it to the slave with FileDownload or StringDownload.

如果需要运行代码在自己的从属进程中,您需要修补从属,添加新命令,然后在主控上创建一个 相应的 BuildStep ,您的新命令。这需要修改要在其上运行代码的 all 从站上的buildslave代码。此文件未在任何地方记录,因此您需要查看代码以弄清楚该操作的方法。

If you require the code to run in the slave process it self, you need patch the slave, to add a new command, and create a corresponding BuildStep on the master, that calls your new command. This requires modifying the buildslave code on all slaves that you want to run the code on. This isn't documented anywhere, so you will need to have a look at the code to figure out how to do this.

这篇关于向Buildbot添加自定义功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆