CI | jenkins python Thu 19 January 2012 Olivier Mansion

We released today a new version of the ShiningPanda plugin for Jenkins. For those who don't know this plugin yet, it is probably the easiest way to setup your Python projects with Jenkins. But let's have a look at the new features:

A new Nature field

This field is now available on the following builders:

  • Virtualenv Builder,
  • Python Builder,
  • Custom Python Builder.

It determines how the Command contents is executed:

  • Shell: execute the Command contents with /bin/sh on Unix and cmd.exe on Windows,
  • XShell: convert the Command contents to match the platform and execute the result with /bin/sh on Unix and cmd.exe on Windows,``
  • Python: execute the Command contents with a Python interpreter.

The XShell nature is recommended when a project is tested on both Unix and Windows. Conversions and best practices are:

  • Environment variables conversion, for instance $VAR becomes %VAR% when executed on Windows,
  • Separator conversion, for instance a slash becomes a backslash when executed on Windows,
  • The workspace is added to PATH so as to avoid the ./ prefix to execute a script in the current folder. Doing this makes Command Windows compatible. For instance instead of writing ./runtests, type in runtests: on Unix it calls runtests and runtests.bat on Windows

For example this Unix style Command:

1 $PYTHON_EXE install
2 runtests etc/cis.ini

Becomes on Windows:

1 %PYTHON_EXE% install
2 runtests etc\cis.ini

And vice-versa.

A new publisher

This publisher allows you to display the coverage HTML reports from Jenkins.

To enable it, step in the Post-build Actions and check the Publish HTML report box.

Then reports are accessible via the Report link on project and build main page.

Extended Tox Builder

A new TOXENV pattern field provides an alternative to the Tox axis. Its value is expanded to retrieve the Tox environment to execute.

This is typically used with User-defined Axis, for instance an INTERPRETER="py27 py32" one and a DATABASE="mysql postgres" one. In this case, setting TOXENV pattern to ${INTERPRETER}-${DATABASE} will execute the following Tox environments:

  • py27-mysql,
  • py27-postgres,
  • py32-mysql,
  • py32-postgres.

Auto detect installations

The plugin now detects Python installations in standard locations at first launch.