返回介绍

3.3.23. How to package Buildbot plugins

发布于 2023-09-20 23:50:40 字数 4234 浏览 0 评论 0 收藏 0

Caution

Buildbot no longer supports Python 2.7 on the Buildbot master.

3.3.23. How to package Buildbot plugins

If you customized an existing component (see Customization) or created a new component that you believe might be useful for others, you have two options:

  • submit the change to the Buildbot main tree, however you need to adhere to certain requirements (see Buildbot Coding Style)

  • prepare a Python package that contains the functionality you created

Here we cover the second option.

3.3.23.1. Package the source

To begin with, you must package your changes. If you do not know what a Python package is, these two tutorials will get you going:

The former is more recent and, while it addresses everything that you need to know about Python packages, it’s still work in progress. The latter is a bit dated, though it was the most complete guide for quite some time available for Python developers looking to package their software.

You may also want to check the sample project, which exemplifies the best Python packaging practices.

3.3.23.2. Making the plugin package

Buildbot supports several kinds of pluggable components:

  • worker

  • changes

  • schedulers

  • steps

  • reporters

  • util

(these are described in Plugin Infrastructure in Buildbot), and

  • www

which is described in web server configuration.

Once you have your component packaged, it’s quite straightforward: you just need to add a few lines to the entry_points parameter of your call of setup function in setup.py file:

setup(
    ...
    entry_points = {
        ...,
        'buildbot.{kind}': [
            'PluginName = PluginModule:PluginClass'
        ]
    },
    ...
)

(You might have seen different ways to specify the value for entry_points, however they all do the same thing. Full description of possible ways is available in setuptools documentation.)

After the setup.py file is updated, you can build and install it:

$ python setup.py build
$ sudo python setup.py install

(depending on your particular setup, you might not need to use sudo).

After that, the plugin should be available for Buildbot and you can use it in your master.cfg as:

from buildbot.plugins import {kind}

... {kind}.PluginName ...

3.3.23.3. Publish the package

This is the last step before the plugin becomes available to others.

Once again, there is a number of options available for you:

  • just put a link to your version control system

  • prepare a source tarball with the plugin (python setup.py sdist)

  • or publish it on PyPI

The last option is probably the best one since it will make your plugin available pretty much to all Python developers.

Once you have published the package, please send a link to buildbot-devel mailing list, so we can include a link to your plugin to Plugin Infrastructure in Buildbot.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文