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 :

PAGURE_SECRET : Dictionary with the key being the Pagure Project Name and the value being the Private key provided by pagure. This key is used to authenticate the POST requests received by the service.

OPENSHIFT_SECRET : Secret used to trigger the generic webhook of openshift.

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.

JENKINS_URL : URL address of the Jenkins instance to use to trigger builds

JENKINS_JOB_COMMIT : Name of the Jenkins job to trigger for every commit

JENKINS_JOB_PR : Name of the Jenkins job to trigger when a new PR is opened

JENKINS_SECRET : Secret token used by Jenkins to authenticate the build requests

LOG_DEBUG : Set to True to turn on DEBUG trace

Pagure configuration

In the project's settings generate a Private web-hook key this is your PAGURE_SECRET. 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.