Sign inSign up

mssola/openhub

By mssola

•Updated over 8 years ago

Glue service between OBS and DockerHub.

Image
1

5.2K

mssola/openhub repository overview

⁠openhub Build Status Go Report Card

openhub is a small glue service between an Open Build Service⁠ instance and the Docker Hub⁠.

The main task of openhub is to check whether there is an update on an RPM, and then trigger a Docker image rebuild on a tag. This is done through a configuration that looks like this:

services:
  portus-head:
    project: "Virtualization:containers:Portus"
    distribution: "openSUSE_Leap_42.3"
    architecture: "x86_64"
    package: "portus"
    repository: "opensuse/portus"
    tags: ["head"]
  portus-2.3:
    project: "Virtualization:containers:Portus:2.3"
    distribution: "openSUSE_Leap_42.3"
    architecture: "x86_64"
    package: "portus"
    repository: "opensuse/portus"
    tags: ["2.3", "latest"]

In the above example, we are telling openhub to listen for changes on Virtualization:containers:Portus and Virtualization:containers:Portus:2.3 (particularly on the portus package from Leap 42.3 and the x86_64 architecture). Whenever there is a new revision, then it will trigger a Docker image rebuild on the proper repository/tag combination.

You can run openhub like this:

$ openhub <path-to-config-file>

We also provide a Docker image and a docker-compose.yml file as an example on how to deploy it. Note that you also need to specify some environment variables:

  • OPENHUB_OBS_USER: the user to be used on the Open Build Service server.
  • OPENHUB_OBS_PASSWORD: the password for the above user.
  • OPENHUB_DOCKER_TOKEN: the token to be used when authenticating with the DockerHub. A token can be generated by activating triggers on the "Build Settings" tab on the repository page.

⁠Installation

You can install openhub from source by cloning this repository and then performing the following command:

$ make install

⁠Development

You could build this project as any other Go binary with go build, but this is not recommended. Instead, use the default make target:

$ make
# or the equivalent `make openhub`

With this command, openhub will be built with the desired build flags and setting the proper version for it. Note that the build can be further customized with the BUILD_FLAGS variable. So, you could pass extra arguments like so:

$ make BUILD_FLAGS="-v"

When doing this you should be careful to not conflict with a default build flag.

⁠Unit testing

Unit testing is performed through the test-unit make target:

$ make test-unit
⁠Validation

Besides running tests, we also perform some validation tests on the code. These tests can be run like this:

$ make validate
⁠What the CI will end up running

The CI will only run the ci target, which will in turn:

  1. Run all validators.
  2. Run unit tests.

It is recommended that you perform make ci before submitting a pull request, and check that it ran successfully.

⁠License

Copyright (C) 2018 Miquel Sabaté Solà <[email protected]>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

Tag summary

Content type

Image

Digest

Size

207.3 MB

Last updated

over 8 years ago

docker pull mssola/openhub