README.md

PAGURE-2-OPENSHIFT

pagure-2-openshift is webhook proxy service that allow to trigger Openshift build using pagure webhook feature.

This service act as a bridge between Pagure and Openshift, it receives Pagure's webhook POST requests sent on every commit made to the git repository and sent a POST request with the format expected by Openshift to trigger a new build.

Configuration

pagure-2-openshift is using the following configuration keys :

WEB_HOOK_KEY : Private key provided by pagure. This key is used to authenticate the POST requests received by the service

OPENSHIFT_CLUSTER : hostname of the openshift cluster used to build an application

OPENSHIFT_PROJECT : Name of the project (namespace) in openshift.

OPENSHIFT_APP : Name of the application to build with openshift.

Openshift Build configuration

The WEB_HOOK_KEY is also used to authenticate with Openshift, therefore this key needs to be added to the build configuration under the triggers section as follow:

triggers:
    - generic:
        secret: 6S52PA9X7VM10R9XC7SH9N89A4S2VR6IIU4TU7XJ
    type: Generic

Pagure configuration

In the project's settings generate a Private web-hook key this is your WEB_HOOK_KEY. Then in the Project options add the following url to the Activate Web-hooks input box http://hostnameofpagure2openshift:5000/pagure. Finally in the Hooks activate the Fedmsg.

Install and Run

To install the application use the provided requeriments.txt and pip in a virtual environment.

$ python3 -m venv .p2o
$ source .p2o/bin/activate
(p20) $ pip install -r requirements.txt

To run the application use gunicorn web server inside the virtual environment.

(p20) $ gunicorn --worker 1 --bind 0.0.0.0:5000 wsgi:application

Change the number of worker if you need to scale the service.

Deployment on Openshift

To deploy a pagure-2-openshift service on Openshift use the provided openshift.json this will create everything required except for the configMap that will hold the configuration items.

Before importing the openshift.json file create a configMap using the provided configmap.yml and update the configuration values.