[users at bb.net] Help on custom hook

Pierre Tardy tardyp at gmail.com
Fri Nov 3 13:44:19 UTC 2017


Hi Shulhan,
I realize the doc is quite concise. the custom handler will only work for
overriding an existing plugin handler, so you should use:
c['www'] = {
        ...
        ,       "change_hook_dialects":{
                        "base": {
                                "custom_class": MattermostCommandHandler
                        }
                }
        }
and then point your mattermost hook to  http://yourbotip/change_hook/base

If you want to point to http://yourbotip/change_hook/mattermost
<http://yourbotip/change_hook/mattermost>  you have no choice but to make a
buildbot plugin
HTH
Pierre

On Fri, Nov 3, 2017 at 5:30 AM Shulhan <m.shulhan at gmail.com> wrote:

> On Thu, 02 Nov 2017 18:46:34 +0000
> Pierre Tardy <tardyp at gmail.com> wrote:
>
> Hi Mr. Tardy,
>
> Thanks for quick reply and answer.
>
> > Hi Shulhan,
> >
> > The www hooks are now customizable via the buildbot plugin system
> >
> > The default one are configured here.
> > https://github.com/buildbot/buildbot/blob/master/master/setup.py#L415
> >
> > I would suggest you to create your own python package and distribute
> > your buildbot-mattermost plugin on pypi.
>
> Currently this is not an option right now due to time constraints and
> my limited Python knowledge.
>
> >
> > If your plugin is simple enough, you can also fit it in the
> > master.cfg. See doc at
> > http://docs.buildbot.net/latest/manual/cfg-wwwhooks.html#custom-hooks
> >
>
> So, I change the custom hook based on example above.
>
> - Copy the script `mattermost.py` to build master directory
> - Change master.cfg to,
>
> ```
> from mattermost import MattermostCommandHandler
>
> c['www'] = {
>         ...
>         ,       "change_hook_dialects":{
>                         "base": {
>                                 "mattermost": MattermostCommandHandler
>                         }
>                 }
>         }
> ```
>
> - Restart the buildmaster service
> - Test executing command from Mattermost
>
> Output from buildmaster,
>
>   2017-11-03 04:20:09+0000 [_GenericHTTPChannelProtocol,0,172.32.1.208]
> The dialect specified, 'mattermost', wasn't whitelisted in change_hook
>   2017-11-03 04:20:09+0000 [_GenericHTTPChannelProtocol,0,172.32.1.208]
> Note: if dialect is 'base' then it's possible your URL is malformed and we
> didn't regex it properly
>
> Does the "base" config above translated to "/custom_hook/mattermost"?
>
> And then I try load custom hook with following config,
>
> ```
> c['www'] = {
>         ...
>         ,       "change_hook_dialects":{
>                         "base": {
>                                 "mattermost": MattermostCommandHandler
>                         }
>                 ,       "mattermost": True
>                 }
>         }
> ```
>
> The buildmaster output,
>
>   2017-11-03 04:25:17+0000 [_GenericHTTPChannelProtocol,0,172.32.1.208]
> The dialect specified, 'mattermost', is not registered as a
> buildbot.webhook plugin
>
> Thanks in advance for your help.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.buildbot.net/pipermail/users/attachments/20171103/e70700ec/attachment.html>


More information about the users mailing list