jenkins

Sony contributes to Jenkins software tool

Today, Sony contributes three new plugins to the Jenkins software tool: Build Failure Analyzer plugin, Metadata plugin and External Resource Dispatcher plugin. Jenkins is a software development tool that is used for building and testing software continuously during the development. At Sony, we are heavy users of Jenkins, and we like to contribute to making it even more useful for everyone else using it. And by making these plugins available, we can get valuable feedback from the Jenkins community. Learn more after the jump, as Robert Sandell and Tomas Westling from our software tools department explains more!

Robert Sandell and Tomas Westling, software tools developers at Sony.

Hi! We are Robert Sandell and Tomas Westling, software tools developers at Sony. When developing the Xperia™ smartphones, we use Jenkins all the time, and we like it very much. In fact, every line of code in our phones has been built and tested several times by Jenkins before it reaches our customers.

The Jenkins build and test system consists of a master server and usually lots of slaves. The server dispatches builds to the slaves, which is where the real work is done. Then the slaves report back to the server, which runs the UI.

There are actually more than 500 plugins available in Jenkins, and together with the plugin framework, they make it possible for us to customise the tool to our needs. We use many plugins as they are, and in addition they also provide us with a lot of code examples that are useful when we develop our own plugins.

But we also want to give something back to the Jenkins community, and therefore we regularly contribute bug fixes and plugins to the Jenkins project. And by contributing our plugins, the quality of the sowftware is increased, since the larger user base provides us with bug reports, bug fixes and features that we haven’t thought of ourselves. And today we are now releasing three new plugins – a Build Failure Analyzer plugin, a Metadata plugin and an External Resource Dispatcher plugin. They can all be downloaded from the Jenkins update center within your Jenkins implementation.

Scan build logs with the Build Failure Analyzer plugin

Screenshot from the Build Failure Analyzer plugin.

This plugin scans the build log of every non-successful build, and presents the cause of why the build failed directly on the build page in Jenkins. To do this, the plugin uses a knowledge base that you build up yourself, through adding patterns of what can go wrong in your environment. The knowledge base can be shared between Jenkins masters.

Using the Build Failure Analyzer plugin means that you don’t have to waste time to go through the log yourself, but instead you can take action immediately. This is good for any setup where users spend a lot of time hunting for reasons behind build failures.

Put metadata on jobs and more with the Metadata plugin

Screenshot from the Metadata plugin.

The Metadata plugin, which is a beta version, provides facilities to put metadata on jobs, builds and slaves in Jenkins. This is especially useful for large Jenkins installations where you need database-like search features.

The metadata can be provided by users, administrators or other plugins, and is stored in a database for future queries, such as  “list all jobs that was building with a specific JDK version” or “list all jobs that has more than ten FindBugs errors on the release branch”.

The benefit of this plugin increases with the amount of other plugins providing metadata. This is why we are releasing it as a beta version so we can get feedback and create a good first version of the API. This way we hope to inspire other plugin developers to add support for it.

Book resources for a build with the External Resource Dispatcher plugin

Screenshot from the External Resource Dispatcher plugin.

The External Resource Dispatcher plugin should be used when you have external resources attached to the slaves. Jenkins today has a notion of labels that lets the user configure a job to run on slaves with specific capabilities determined by that label. This plugin takes this function a bit further by making it possible to specify what kind of external resource should be available on the slave.

In our case, we want to run automatic tests on phone hardware attached via USB to the slave computer, but with the community in mind, we wrote the plugin so that it can dispatch to any kind of external resource, regardless of if it’s an Xperia™ smartphone, a printer or a USB driven Christmas tree.

To do this, the plugin provides a new metadata type for the Metadata plugin described above, called “External Resource”. The External Resource parameter can contain any type of metadata which can then be specified in the selection criteria for the job. For example “any device running Android 4.1 and a screen size of 4.7 inches” or “product.name==Xperia™ T”. The resource will then be booked by that build, so that no other build will be able to use it until the build is finished.

The plugin also contains a lot of APIs and commands for external tools to act as “booking agents” and provide the plugin with information. For example, a tool we have in mind of developing is a service running on each slave that detects when an Android device is connected. It would then probe that device for properties and automatically add that device to the slave in question in Jenkins. It will also remove it when it is disconnected, giving the illusion of a cloud of phones ready to receive tests to run.

Also check out our previous contributions to Jenkins
Previously, we have contributed three plugins that we are now maintaining in the Jenkins community:

  • Gerrit Trigger plugin – this plugin integrates Jenkins with the Gerrit Code review. This lets Jenkins verify changes when they are uploaded to Gerrit before being merged to the main branch (pre-verified commits).
  • Rebuild plugin – this plugin allows a user to rebuild a parameterised build without re-entering the same parameters again.
  • Multi slave config plugin – makes it possible for administrators to add, remove and configure several Jenkins slaves at the same time. This is a very useful plugin when dealing with large clusters.

Jenkins notifications for the Sony SmartWatch
On a side note, we want to show you the BuildWatch, which is a cool SmartWatchapp extension made by some friends of ours. By using it, you won’t have to sit around and wait for a build to finish anymore, since you will get instant notifications of the result to your SmartWatch. Download the BuildWatch from Google Play and try it out!

***

So, are you a Jenkins user? Check out these new plugins, and let us know what you think in the comments below!

More information

Jenkins logo courtesy of the Jenkins project (http://jenkins-ci.org/)