Packaging/webhooks

= Webhooks in Mer =

Mer uses the OBS as the main project/package management and build system and all source is stored in git repositories.

Webhooks are used to link these systems together as simply as possible.

Each time a tag is pushed to a git repository a notice is sent to the webhook system and the cibot user tells the OBS to rebuild any packages using that git repo.

In practice each package has a webhook service which specifies (at least) the git repository and the branch to be used and the cibot user is granted access to the project.

Some projects are managed by promotions and have webhooks disabled - builds will not be triggered in them.

Webhook activity is reported on the #mer-boss channel on freenode.

= Using Webhooks =

Don't forget to enable Webhooks on any git repository you use.

Command line
There's a helper script called  which you can find in the Mer sdk-utils package.

You must have a Mer account and have  setup before you can use the   utility.

Usages is simple:

wh  [ ] eg   wh home:lbt:nemo nemopkg http://github.com/lbt/nemopkg.git

If you have write permission to the and/or then everything is setup for you. When it's done you'll get OBS links where you can edit the description too.

Web Interface
Go to the user tab for the project and add cibot as a maintainer.

Create a package as usual and create a file called  which contains an XML description of the web hook.

Adjust this XML template to your needs. https://github.com/....blah.git master

= Typical use cases =

Create a new project/package
From the Mer SDK simply use :

wh home:me:work mypkg http://git.merproject.org/me/mypkg.git

Don't forget to enable Webhooks on the git repository

Copy a package to a personal work area and use a different branch or repo
You can just copy or branch the package - you'll get a webhook automatically. You can then edit the _service file and change the branch or repourl param values.

Branching is useful as it will ensure the same build repositories are used.

From the command line you can use  to branch the package (to setup the repos you need) and then use the   command to setup/replace the webhook.

Eg clone https://github.com/nemomobile/dsme.git on github and then, in the SDK run:

osc branch nemo:devel:mw/dsme wh home:lbt:branches:nemo:devel:mw dsme https://github.com/lbt/dsme.git myfeaturebranch

Any tags pushed to myfeaturebranch on that repo will now build a package in your branch area.

Promote a package
Just promote as usual.

Maintainers should have added the project to the list of disabled webhook projects so only the git packaging service will run and that will use a fixed commit.

Delete a package
Just delete the package. Webhooks which reference a deleted package will be deleted periodically.

= Enabling Webhooks on the git repository =

git.merproject.org

 * 1) Go to your package repository
 * 2) Click on Settings
 * 3) Click on Web Hooks
 * 4) Add https://webhook.merproject.org/webhook/ as the URL
 * 5) Enable Tag push events

github.com

 * 1) Go to your package repository
 * 2) Click on Settings
 * 3) Click on Web Hooks & Services
 * 4) Add https://webhook.merproject.org/webhook/ as the Payload URL
 * 5) Content type should be application/json
 * 6) Enable SSL verification
 * 7) Enable Just the push event
 * 8) Enable Active

bitbucket.org

 * 1) Go to your package repository
 * 2) Click on Settings
 * 3) Click on Hooks
 * 4) Select POST type and Add hook
 * 5) Add https://webhook.merproject.org/webhook/ as the URL