为Buildbot添加自定义功能

发布于 2024-12-06 00:25:03 字数 146 浏览 2 评论 0原文

我用 python 编写了一个函数,我想让 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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

温暖的光 2024-12-13 00:25:03

您希望代码在主机上运行还是在从机上运行?

如果你想在master上运行代码,那么你需要做的就是子类BuildStep,并将你的代码放在.start中(请参阅vernomcrp的答案中的链接)。

如果你想在从机上运行代码,事情就会变得更加棘手。最简单的解决方案是您可以编写一个 python 脚本(而不是函数),然后执行该脚本。您可以将该脚本包含在存储库中,或者使用 FileDownloadStringDownload

如果您需要代码在从属进程中运行,则需要修补从属进程,添加新命令,在主进程上创建相应的BuildStep,即调用您的新命令。这需要修改您想要运行代码的所有从站上的 buildslave 代码。这在任何地方都没有记录,因此您需要查看代码才能弄清楚如何执行此操作。

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

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

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.

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.

一直在等你来 2024-12-13 00:25:03

我认为我们可以自定义 buildstep 来执行 python 函数。看看这个链接 http://buildbot.net/buildbot/docs/latest /manual/customization.html。我认为它有你想要的东西。 :)

I think we can customize buildstep to execute python function. Have a look at this link http://buildbot.net/buildbot/docs/latest/manual/customization.html. I think it has something what you want. :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文