Webhooks

From SailfishOS Documentation
Revision as of 09:46, 10 April 2016 by Blam (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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:


  1. Go to the package repository web page
  2. Click on "Settings"
  3. Click on "Web Hooks"
  4. Add https://webhook.merproject.org/webhook/ as the URL
  5. 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:


  1. Go to the web page for the project (e.g. https://build.merproject.org/package/show/mer-core:devel/ofono)
  2. Click on the "Users" tab
  3. Click the "Add user" link (only available if you have the required project permissions)
  4. 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.