Linux Kamarada

Integrating the Open Build Service with GitHub

If you are developing software for Linux, you should know the Open Build Service (OBS). What does it do that makes it such an interesting tool? Let me quote its website:

The Open Build Service (OBS) is a system to build and distribute binary packages from sources in an automatic, consistent and reproducible way. You can release packages as well as updates, add-ons, appliances and entire distributions for a wide range of operating systems and hardware architectures.

In practice, you software developer can upload your software souce to OBS and build ready to install packages for openSUSE, Fedora, Debian, Ubuntu and other distributions, as well as packages for i586, x86_64, ARM and other architectures. Your software users can download those packages directly from OBS. It is also able to build Live images, so users can try your software on a clean and controlled system prior to actually installing anything.

OBS is free software, so you can download, install and run it on a server of your own. Or (easier) you can use the reference server publicly and freely available at That server is used mainly for development of the openSUSE distribution, but it also hosts many community projects.

Also, if you are a software developer, you probably know Git and GitHub — they need no introduction. What if I tell you that you can integrate OBS with GitHub so that you always get your software built and available for download right after a git push?

How to set up that integration is what you are going to see here.

OBS basics

I’m not going to dive into OBS basics here, I’ll write an entire post about them someday. By now, you can find how to get started with OBS here:

I assume that you are able to login with your openSUSE account at (if you don’t have an account yet, click on the Sign Up link at the top of the page to create one).

Create an empty package for your software at OBS. Here I’m going to use as example the Linux Kamarada’s patterns GitHub repository, which by now has just a spec file.

If you don’t know what a spec file is and/or are new to RPM packaging, read these:

I also assume that you have installed osc, the OBS command-line client, on your machine. If you are using openSUSE, you can do that running:

# zypper install osc

Checkout your OBS home project using:

$ osc checkout home:username

Enter the package directory:

$ cd home:username/packagename

Now let’s integrate OBS with GitHub.

OBS: retrieving sources from GitHub

Set up the source service to retrieve sources from GitHub using osc:

$ osc add git://

Edit the generated _service file and exchange its contents with:

    <service name="obs_scm">
        <param name="scm">git</param>
        <param name="url">git://</param>
        <param name="revision">15.1-dev</param>
        <param name="extract">patterns-kamarada-gnome.spec</param>

Note that I’m using the 15.1-dev branch. If you are going to use the master branch for your package, you can just omit the revision parameter.

Commit changes:

$ osc commit

Commiting to OBS automatically triggers the source service and the build process. If you go to, your project is already building:

In order for GitHub to trigger your package build you need to generate a token using osc:

$ osc token --create home:username packagename

The command will return the token and its id:

<status code="ok">
  <data name="token">AcRaZyStRiNgWhIcHiSyOuRtOkeN</data>
  <data name="id">4321</data>

As a test, you can manually trigger your package build using the generated token:

$ osc token --trigger AcRaZyStRiNgWhIcHiSyOuRtOkeN

If you go to, your project is building.

GitHub: alerting OBS of new commits

We want to update our package sources in OBS whenever they change in GitHub. We can have GitHub trigger that update automatically setting up a GitHub webhook.

To do this execute the following steps:

  1. Sign in to GitHub and go to your repository (in my case,
  2. Click Settings
  3. Click Webhooks
  4. Click the Add webhook button:

Provide the following parameters:

  • Payload URL: (remember to replace 4321 by your token’s id)
  • Content type: application/x-www-form-urlencoded (default)
  • Secret: AcRaZyStRiNgWhIcHiSyOuRtOkeN

Leave the other parameters with their default values:

  • SSL verification: Enable SSL verification
  • Which events would you like to trigger this webhook? Just the push event.
  • Active

Finally, click the Add webhook green button:

Back to the previous page, you can see the added webhook:

From now on, each git push to GitHub will trigger a package rebuild in OBS. Your username will appear in the osc log source history.

Have a lot of fun!


Would you buy me a coffee?
If you really liked it, if it was really helpful for you, is it worth a coffee? If you want, you can "buy me a coffee" with PayPal or contribute to the project in other ways.



The Linux Kamarada Project aims to spread and promote Linux as a robust, secure, versatile and easy to use operating system, suitable for everyday use be at home, at work or on the server. The project focuses mainly on distribution and documentation.