Navigation

The /change_hook url is a magic URL which will accept HTTP requests and translate them into changes for buildbot.
Implementations (such as a trivial json-based endpoint and a GitHub implementation) can be found in master/buildbot/www/hooks.
The format of the url is /change_hook/DIALECT where DIALECT is a package within the hooks directory.
Change_hook is disabled by default and each DIALECT has to be enabled separately, for security reasons

An example www configuration line which enables change_hook and two DIALECTS:

Within the www config dictionary arguments, the change_hook key enables/disables the module and change_hook_dialects whitelists DIALECTs where the keys are the module names and the values are optional arguments which will be passed to the hooks.

The master/contrib/post_build_request.py script allows for the submission of an arbitrary change request.
Run post_build_request.py --help for more information.
The base dialect must be enabled for this to work.

There is a standalone HTTP server available for receiving GitHub notifications as well: master/contrib/github_buildbot.py.
This script may be useful in cases where you cannot expose the WebStatus for public consumption.

The GitHub hook has the following parameters:

secret (default None)

Secret token to use to validate payloads.

strict (default False)

If the hook must be strict regarding valid payloads.
If the value is False (default), the signature will only be checked if a secret is specified and a signature was supplied with the payload.
If the value is True, a secret must be provided, and payloads without signature will be ignored.

codebase (default None)

The codebase value to include with created changes.
If the value is a function (or any other callable), it will be called with the GitHub event payload as argument and the function must return the codebase value to use for the event.

class (default None)

A class to be used for processing incoming payloads.
If the value is None (default), the default class -- buildbot.status.web.hooks.github.GitHubEventHandler -- will be used.
The default class handles ping, push and pull_request events only.
If you'd like to handle other events (see Event Types & Payloads for more information), you'd need to subclass GitHubEventHandler and add handler methods for the corresponding events.
For example, if you'd like to handle blah events, your code should look something like this:

frombuildbot.status.web.hooks.githubimportGitHubEventHandlerclassMyBlahHandler(GitHubEventHandler):defhandle_blah(self,payload):# Do some magic herereturn[],'git'

This URL should point to /change_hook/github relative to the root of the web status.
For example, if the base URL is http://builds.example.com/buildbot, then point GitHub to http://builds.example.com/buildbot/change_hook/github.
To specify a project associated to the repository, append ?project=name to the URL.

Content Type

Specify application/x-www-form-urlencoded or application/json.

Secret

Any value.
If you provide a non-empty value (recommended), make sure that your hook is configured to use it:

Leave the default -- Justthepush[tag]events -- other kind of events are not currently supported.

And then press the AddWebhook button.

Warning

The incoming HTTP requests for this hook are not authenticated by default.
Anyone who can access the web server can "fake" a request from GitHub, potentially causing the buildmaster to run arbitrary code.

To protect URL against unauthorized access you should use Change Hooks Auth option.
Then change the the PayloadURL of your GitHub webhook to https://user:password@builds.example.com/bbot/change_hook/github.

The BitBucket hook is as simple as GitHub one and it takes no options.

c['www']=dict(...,change_hook_dialects={'bitbucket':True}))

When this is setup you should add a POST service pointing to /change_hook/bitbucket relative to the root of the web status.
For example, it the grid URL is http://builds.example.com/bbot/grid, then point BitBucket to http://builds.example.com/change_hook/bitbucket.
To specify a project associated to the repository, append ?project=name to the URL.

Note that there is a standalone HTTP server available for receiving BitBucket notifications, as well: master/contrib/bitbucket_buildbot.py.
This script may be useful in cases where you cannot expose the WebStatus for public consumption.

Warning

As in the previous case, the incoming HTTP requests for this hook are not authenticated by default.
Anyone who can access the web status can "fake" a request from BitBucket, potentially causing the buildmaster to run arbitrary code.

The poller hook allows you to use GET or POST requests to trigger polling.
One advantage of this is your buildbot instance can poll at launch (using the pollAtLaunch flag) to get changes that happened while it was down, but then you can still use a commit hook to get fast notification of new changes.

When this is setup you should add a POST service pointing to /change_hook/gitlab relative to the root of the web status.
For example, it the grid URL is http://builds.example.com/bbot/grid, then point GitLab to http://builds.example.com/change_hook/gitlab.
The project and/or codebase can also be passed in the URL by appending ?project=name or ?codebase=foo to the URL.
These parameters will be passed along to the scheduler.

Note

Your Git step must be configured with a git@ repourl, not a https: one, else the change from the webhook will not trigger a build.

Warning

As in the previous case, the incoming HTTP requests for this hook are not authenticated by default.
Anyone who can access the web status can "fake" a request from your GitLab server, potentially causing the buildmaster to run arbitrary code.

To protect URL against unauthorized access you should either

set secret token in the configuration above, then set it in the GitLab service hook declaration, or

use the Change Hooks Auth option. Then, create a GitLab service hook (see https://your.gitlab.server/help/web_hooks) with a WebHook URL like https://user:password@builds.example.com/bbot/change_hook/gitlab.

Note that as before, not using change_hook_auth can expose you to security risks.

The Gitorious hook is as simple as GitHub one and it also takes no options.

c['www']=dict(...,change_hook_dialects={'gitorious':True})

When this is setup you should add a POST service pointing to /change_hook/gitorious relative to the root of the web status.
For example, it the grid URL is http://builds.example.com/bbot/grid, then point Gitorious to http://builds.example.com/change_hook/gitorious.

Warning

As in the previous case, the incoming HTTP requests for this hook are not authenticated by default.
Anyone who can access the web status can "fake" a request from your Gitorious server, potentially causing the buildmaster to run arbitrary code.

To protect URL against unauthorized access you should use Change Hooks Auth option.
Then, create a Gitorious web hook with a WebHook URL like https://user:password@builds.example.com/bbot/change_hook/gitorious.

Note that as before, not using change_hook_auth can expose you to security risks.

Note

Web hooks are only available for local Gitorious installations, since this feature is not offered as part of Gitorious.org yet.