how to set up jenkin's 'GitHub Pull Request Builder Plugin' for django ?

100 views
Skip to first unread message

Abraham Varricatt

unread,
Jan 5, 2016, 9:57:46 PM1/5/16
to Django users
Hello everyone,

I've got a very simple django project hosted on github ( https://github.com/abrahamvarricatt/TDDwithPython ; yes, it's based on the book ) and I'm trying to figure out how to configure a jenkins CI server to run tests based on pull requests. My end objective is to get a system similar to what the Pelican project ( https://github.com/getpelican/pelican/pulls ) is doing, but with Jenkins instead of TravisCI. i.e. if anyone makes a pull request, github should send a signal to jenkins to start a test run, depending on the results, jenkins will comment back YES if all unit tests pass, else it will comment back NO. The comments should be made on the pull request. Most importantly, when jenkins comments back, it should include links to the results of the test so that anyone can check it out. 

Admittedly, I haven't tried setting up a jenkins CI server just yet, so I'm not sure what (if any) problems I might encounter, but I have been searching online for any similar django-specific setups and haven't found any. :(  

So, here's my real question - Has anyone done anything similar for a django project? If so, are there any published instructions I can follow or use as a reference?

Thinking of proceeding without guidance,
Abraham V.

Abraham Varricatt

unread,
Jan 8, 2016, 12:25:43 PM1/8/16
to Django users
Hello everyone,

I've attained some success in my endeavor and wanted to talk about it (The following events take place over the past few days). 

The first thing I needed to do was rent out a cheap ubuntu server - I got one from digitalocean. A requirement for jenkins is java. I decided to go with Oracle's java-8. There were some instructions here,

Basically, it was a matter of installing a PPA, doing an update and running the java-8 installer. Then it was onto jenkins. I decided not to bother with the one from Canonical and went straight for the official stuff. Instructions here,

Installing was easy. Configuring it was a mess. Jenkins will let the first person to access the web-interface perform configurations, and .. well, I screwed it up. The end result was that I locked myself out of my own jenkins server! This kind-of devastated me for some time. I REALLY didn't want to restart from scratch and searched for some way to fix the mess (I still had shell access to the system, just not web access). Amusingly enough, it turns out that the scenario is common enough for the jenkins devs to mention it on their wiki! Here,

Finding my jenkins config file was not as straight-forward as I would have liked, but in the end, I got things done. With jenkins up and running, I decided to just try the instructions from the TDD book. Here's the link to the online chapter,

This .. actually worked. It worked! I was able to initiate builds from jenkins!

The next step was to try and automate things, so that if I make a pull request, jenkins would build and comment back on the request. For this, I needed to use the 'github pull request builder plugin'. It was a lot more difficult than I expected. At first, I tried following the instructions here,

Not exactly helpful. I think the blog was written with an older version of the suite in mind. I ended up making a few jenkins jobs - the lot didn't work as I was hoping it would and in frustration, I deleted them all. Around then, I discovered this,

Yes, the official jenkins wiki. Short story: it worked. You can now point and laugh at my stupidity. But darn! I had to read those instructions multiple times, compare them with what my jenkins instance was showing me before, finally getting it to work. But it now does and I'm happy. :)

Oh yeah - at some point, the whole 'jenkins bot needs access to repo' really confused me. I actually transferred the repo between my github account and my bot's account multiple times before deciding to make an organization and giving everyone ownership rights. The idea of webhooks also took me for a spin. I wanted to have github inform jenkins when to do the builds, but the instructions I found assume you are running some kind of cron-task. Not really what I like. That took awhile to figure out!

To show-off, here's my jenkins server;

And check out this (dummy) pull request,

This brings me to about .. 85% of what I wanted to setup. The last thing I need to do, is get some build statistics running. I'm looking a the django-jenkins package. Are there any similar options available?

Hoping these mails help someone,
Abraham V.

Luis Zárate

unread,
Jan 8, 2016, 11:04:32 PM1/8/16
to django...@googlegroups.com
Do you know buildbot ?

http://buildbot.net/
> --
> You received this message because you are subscribed to the Google Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
> To post to this group, send email to django...@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/cc3132b7-dcdd-43fb-9f91-de9627686d1b%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

--
"La utopía sirve para caminar" Fernando Birri



Abraham Varricatt

unread,
Jan 9, 2016, 4:49:53 AM1/9/16
to Django users
This might be the first I'm hearing of the tool. I'm aware of online ones like TravisCI, codeship .. etc. But for my purposes, a self-hosted solution was needed and jenkins is what I found at the time.

Are you aware of anyone using buildbot publicly? Does it do github build status commits .. etc? 

-Abraham V.

Luis Zárate

unread,
Jan 9, 2016, 11:00:33 AM1/9/16
to django...@googlegroups.com

2016-01-09 3:49 GMT-06:00 Abraham Varricatt <abraham....@googlemail.com>:
Are you aware of anyone using buildbot publicly?

Sure, python is an example.


It has git support

Luis Zárate

unread,
Jan 9, 2016, 11:05:38 AM1/9/16
to django...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages