Koji Watcher

What is it?

Koji watcher is a service project listening fedora-messaging for successful build info and notify end users or other services via rest API.

Get started

Add libvirt-ci Openshift DNS into /etc/resolve.conf

If $ ping -c 3 registry-console-default.cloudapps.qe-ocp.libvirt.redhat.com get no response, need add private DNS name in the resovle file with:

$ sudo sed -i '/^search/!b;:a;n;//ba;i\nameserver 10.8.241.95' /etc/resolv.conf

Deploy to Openshift Container Platform

Recommend deploy to OCP, the Opensfhit template could be found under openshift dir.

For first time deployment, aginst a running OCP instance, default to https://openshift-stack-lb.qe-ocp.libvirt.redhat.com

Download oc: https://github.com/openshift/origin/releases/latest

Login and create new-app:

$ oc login https://openshift-stack-lb.qe-ocp.libvirt.redhat.com:8443 --token=<hidden>

Check and create new project:

$ oc project

or

$ oc new-project test-new

Create new app:

$ git clone https://gitlab.cee.redhat.com/libvirt-auto/koji-watcher.git
$ cd koji-watcher
$ oc new-app -f openshift/template.yaml

The template include all configurations and if succeed the service should be running now. Now could check the status on Openshift project.

Check the service:

$ curl -X GET http://koji-watcher.cloudapps.qe-ocp.libvirt.redhat.com/info
{"version": "1.0", "name": "LibvirtCIKojiWatcherService", "desc": "Koji watcher of Libvirt CI"}

$ curl -X POST http://koji-watcher.cloudapps.qe-ocp.libvirt.redhat.com/scan/pkgs
OK

then it works!

Update your deployment

If the service already created or deployed in your create project, then as defined in the template file, the app will automatically rebuild when the git repo updated, so any commit will trigger update your service.

Wait and check service again:

$ curl -X GET http://koji-watcher.cloudapps.qe-ocp.libvirt.redhat.com/info
{"version": "1.0", "name": "LibvirtCIKojiWatcherService", "desc": "Koji watcher of Libvirt CI"}

then it works!

Deploy with docker and docker-compose

  1. Clone the repo

    $ git clone https://gitlab.cee.redhat.com/libvirt-auto/koji-watcher.git
    
  2. Build docker image:

    $ cd koji-watcher
    $ sudo docker build -t koji-watcher .
    
  3. Start container:

    $ sudo docker-compose up -d
    

Devel env

On host please make sure koji packages are installed:

$ sudo dnf install koji libcomps python-libcomps -y

For devel env, use virtualenv or pipenv for local setup, here use pipenv:

$ pip install pipenv
$ pipenv --site-packages
$ pipenv shell
$ cd koji-watcher
$ pip install .
$ koji-watcher --help
$ koji-watcher
$ exit

In another shell:

$ curl -X GET localhost:8055/info
{"version": "1.0", "name": "LibvirtCIKojiWatcherService", "desc": "Koji watcher of Libvirt CI"}

then it works!

By default it will connect to Consule service registry which running at:

http://caselink.lab.eng.pek2.redhat.com:8500/

you could check the service status on it.