koji-scripts-and-plugins icon indicating copy to clipboard operation
koji-scripts-and-plugins copied to clipboard

Git Webhook Koji Target variable

Open hanynowsky opened this issue 11 years ago • 5 comments

The KOJI-TARGET variable has a fixed value : 'dist-centos6' which is not what we want n that case. We need a way to get dynamically the TARGET value.

hanynowsky avatar Feb 19 '14 09:02 hanynowsky

Thats true if you have more than one build target. You would need to parse out the build target by the repo name or by a commit message tag like I did with #scratch. Or by any other variable that Github sends you.

philicious avatar Feb 19 '14 11:02 philicious

True then. Offtopic: Suppose the following:

  • we have one global build target named = "centos65".
  • Apache is running on port 80 and port 443 (ssl).
  • We have a stash git webhook that sends an HTTP POst Json data to https://koji.mycompany.com/webhoohdata/mypackage/data; so we're expecting this koji_listener.py to launch a koji build once the HTTP POST notification is received. The question then, is where to put that script?: in /var/lib/kojihub-plugins? or somewhere in apache config folders? I mean how to activate it effectively?
  • So we have to change: application.listen(8080) to application.listen(80) ? Right?

hanynowsky avatar Feb 19 '14 12:02 hanynowsky

Its not a Koji plugin. Its a standalone script that starts an tornado httpd. So you have to pick a free port. You cant use a port that apache is binding to. You can either start it manually "python koji_listener.py >/dev/null 2>&1" or "python koji_listener.py > /var/log/listener.log &" Or you could run it under supervisord or daemontools etc...

If you want it to be served from apache, you would need to rewrite the script. Remove tornado etc..

philicious avatar Feb 19 '14 12:02 philicious

I am sorry! I still can't get it. I am running a koji instance on a CentOS 6.5 machine. if I run it manually, it complains about missing python modules, like tornado.ioloop. Which might be normal since tornado is not installed. How would it get modules like: apache equivalent of tornado.ioloop, apache equivalent of tornado.web, json, koji .... , as they are not native python modules!

-EDIT: Actually tornado is a python web server! I see. In that case, since we are running Apache HTTPD, I need to modify the script to use APACHE!! Some guidance? :(

hanynowsky avatar Feb 19 '14 14:02 hanynowsky

"pip install tornado"

Koji modules are installed along with Koji.

For refactoring, you would need to remove the tornado skeleton and server the python script with mod_python. Its easier to just use it as it is and have a secondary httpd by the tornado.

philicious avatar Feb 19 '14 17:02 philicious