XD blog

blog page

jenkins, python


2014-12-06 Build automation with Jenkins

For the past two months, I updated many times my website. I automated many things but it still takes a while. And my laptop needs to remain opens until it completes. I finally took the decision to spend some time on Jenkins. I use it to compile the documentation of my python modules, to run the unit tests, and maybe publish it to my website. Basically, you can run a command line batch by just clicking and receive an email when it is over or if it has failed. One interesting feature is the possibility to chain the commands. If the commands n succeeds, go to command n+1. You can connect it to GitHub or any source repository. It will update your clone just before building.

It takes less than an hour to install Jenkins, install the necessary plugins and creates the first job. I had difficulties because I was running my python script from a batch command file. The script was not stopping even after Python raised an exception. To do that, the following line must be inserted:

%pythonexe% -u setup.py unittests
if %errorlevel% neq 0 exit /b %errorlevel%

Jenkins is more than a scheduler, it handles security, it can run a script on a different machine.


<-- -->

Xavier Dupré