A webhook is a tool that connects web services together to trigger behaviors when specific actions are detected.
Sailfish OS development makes use of webhooks to automate the testing and release of source code packages on the Mer Open Build Service (OBS). There are webhooks attached to the Sailfish OS source code repositories on the Git server at https://git.merproject.org, and when a new version of a source package in a repository is tagged released through a git tag, the webhook notifies the Mer OBS, which then builds a new version of the package based on the updated repository.
Setting up webhooks for a Sailfish OS repository
Mer webhook services are located at https://webhook.merproject.org/webhook/. To use this webhook to connect a Git server with the Mer OBS and trigger automated builds, you need to:
- Add the Mer webhook to the git code repository
- Allow the Mer OBS cibot service to access the repository to fetch packages
To add a webhook to a https://git.merproject.org code repository:
- Go to the package repository web page
- Click on "Settings"
- Click on "Web Hooks"
- Add https://webhook.merproject.org/webhook/ as the URL
- Enable Tag push events
Then, give the Mer OBS cibot permissions to access the repository, by adding the cibot user as a maintainer for the project. This can be done via the OBS web interface:
- Go to the web page for the project (e.g. https://build.merproject.org/package/show/mer-core:devel/ofono)
- Click on the "Users" tab
- Click the "Add user" link (only available if you have the required project permissions)
- Enter cibot as the user and leave the role as "maintainer", and click the "Add user" button.
Make sure the package has a _service file that lists the webhook details. This should have been automatically generated by OBS when the package was created. For example, the mer-core:devel ofono project has a _service file, as viewable at https://build.merproject.org/package/view_file/mer-core:devel/ofono/_service.
Now that the webhook is set up, the Mer OBS should automatically trigger a build for your project when a new tag is pushed to the remote git repository.