[users at bb.net] Help on custom hook

Shulhan m.shulhan at gmail.com
Fri Nov 3 04:30:18 UTC 2017


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.


More information about the users mailing list