用于与Gitea集成的buildbot插件。
buildbot-gitea的Python项目详细描述
Buildbot Gitea插件
这个buildbot插件添加了与gitea的集成支持,包括推钩子、提交状态更新和更改源。在
安装
pip install buildbot_gitea
这会将自身安装到buildbot的插件发现中,因此不需要额外导入就可以让buildbot找到插件。在
配置
下面的配置显示了如何在buildbot中设置插件的不同部分主控形状.cfg公司名称:
^{pr2}$webhook当前默认支持push和pull请求,但是您可以
子类buildbot_gitea.webhook.GiteaHandler
添加对其他事件的支持,
然后通过设置class
参数来使用子类:
# myhook.pyfrombuildbot_gitea.webhookimportGiteaHandlerclassMyGiteaHook(GiteaHandler)defprocess_whatever(self,payload,event_type,codebase):# This should be a list of dictschanges=[]returnchanges# master.cfgfrommyhookimportMyGiteaHookc['www']={'change_hook_dialects':{'gitea':{'class':MyGiteaHook,# ...}}}
请注意,处理程序需要根据方案命名:
process_{event}
(例如,process_create
等)。在
参数
更换挂钩
change钩子被设置为名为gitea
的www
部分的一部分。在
Parameter | Description |
---|---|
^{ | The secret, which needs to be set in gitea |
^{ | A push may have more than one commit associated with it. If this is true, only the newest (latest) commit of all received will be added as a change to buildbot. If this is set to false, all commits will inside the push will be added. |
^{ | Set this if you want to use your own handler class (see above for details) |
在项目或组织的gitea中,添加gitea类型的新webhook。 设置参数如下:
^{tb2}$更改来源
更改源是克隆gitea存储库的部分构建步骤。如果可以合并pull请求而不发生冲突,那么它包含构建pull请求的特性。这需要与gitea一起使用change_hook
,并让它发送pull请求更新,以便能够处理pull请求。在
它的参数与buildbot中的默认^{change_hook
提供的信息来处理pull请求。在
记者
报告者在gitea中设置提交的提交状态,因此在gitea中,提交消息旁边会显示一个小图标,指示构建状态。在
GiteaStatusPush
被添加到全局主配置的services
部分。在
参数如下:
^{3}$身份验证
Gitea支持OAuth2身份验证,因此可以让buildbot与Gitea通信以对用户进行身份验证。在
./master.cfg
frombuildbot.pluginsimportutilc['www']['auth']=util.GiteaAuth(endpoint="https://your-gitea-host",client_id='oauth2-client-id',client_secret='oauth2-client-secret')
Parameter | Value |
---|---|
^{ | The URL to your Gitea app. Something like ^{ |
^{ | The OAuth2 Client ID ^{ |
^{ | The OAuth2 Client Secret provided, when creating the OAuth application in gitea. Can be a ^{ |
资源:
- 项目
标签: