From Wikitech
Jump to navigation Jump to search

Jenkins is software from the Java community, that assists in building a continuous integration system. It offers a highly modular system which has allowed other communities to add their own plugins (such as GIT, PHP...). Wikimedia Foundation is using Jenkins to run CI tests for MediaWiki and various other products and tools, and to generate alpha builds of the Wikipedia Android app.


Upstream does a release every week and a stable one from time to time, also named Long Term Support (LTS). We will certainly want to at least upgrade to LTS whenever it is released and possibly to a snapshot in between depending on bug fixes.


Debian packages can be installed on Ubuntu and are made available at:

Per ops convention, the packages need to be copied to Reprepro is configured to do so semi-automatically, so on install1002 one only needs to do

 cd /srv/wikimedia
 reprepro checkupdate jessie-wikimedia

verify the output and then

 reprepro update jessie-wikimedia


Jenkins is deployed on contint1001 and contint2001 hosts, reserved for continuous integration purposes. It can safely be restarted at anytime as long as the developer community is aware about it (announce it in #mediawiki and #wikimedia-dev NNN-FIXME minutes beforehand).

When doing an upgrade, you will most probably want to have one continuous integration person floating around because plugin dependencies might break once Jenkins is upgraded. To upgrade the package, just apt-get update && apt-get upgrade jenkins. (or tell puppet to ensure "latest")

Security updates

A few days before releasing a security update, upstream sends a pre-announcement to a mailing list (jenkinsci-advisories). The internal mailing list of the release engineering team is subscribed to it. Upon reception, a security task is filled in Phabricator against #continuous-integration-infrastructure and #jenkins.

The are two kind of security updates for Jenkins:

  • an issue in Jenkins itself, which would triggers a release of Jenkins. It is thus important to always stay up to date and follow Jenkins LTS cycle.
  • issues in plugins, they typically affect several plugins which are released in bulk

When the security update is made public, one has to first review the security bulletin to gauge how affected we are. Some security release of Jenkins do not affect us at all, some others are absolutely critical and require an immediate upgrade. The Jenkins Debian package is updated using reprepro as described above. For plugins, the update is done via the plugin manager.

How to

Restart Jenkins

See mw:Continuous integration/Jenkins#Restart.


Main application logs:

journalctl -u jenkins -f

Disable plugin

Jenkins plugins are placed in /var/lib/jenkins/plugin/ and ends with a .hpi extension. To disable a plugin, rename it to .hpi.disable and restart Jenkins!

Java thread dump

Whenever Jenkins appears to be stuck or facing high CPU usage, you will want to look at the Java threads:

You can also send signal 3 to the java process, Jenkins will write a thread dump in /var/log/jenkins/jenkins.log

kill -3 "pid of jenkins"

kill -3 apparently kills Jenkins :(

Another way:

jstack -F <pid of jenkins>

And there is a more verbose dump written to /var/log/jenkins/jenkins.log

For deadlock detection:

jstack -l -F <pid of jenkins>

Java info

sudo -u jenkins jstat -gcutil PID_HERE 1000 3

Patch a plugin

If you absolutely need to patch a plugin without an upstream release, that's possible. First, fork the Git repository to Gerrit under integration/jenkinsci/, and then submit your patch as a Gerrit change and merge it.

If you need to, update the version number in pom.xml, for example 1.103-wmf.1. Then run mvn install, which should create a <name>.hpi file somewhere. You can upload that file in the Plugin Manager using the "Advanced" tab. If it tells you to restart Jenkins, kill any long running jobs, and then it should restart shortly. Then try out your newly patched plugin!

See also