Jenkins Jabber Plugin with Google Talk

Overview
Jenkins is a continuous integration server communicating with many different protocols, such as SSH, Git and SVN. One of the more interesting ones is around instant messaging. This blog entry will focus on the Jabber protocol and how you can turn Jenkins into Jabber bot with the Jabber plugin.

When the Jabber plugin is installed and configured, Jenkins can send notification messages to a chat room, and users can send messages to Jenkins to obtain information and perform actions, such as builds.

Stable Release Versions
The latest release of the Jabber plugin is 1.22 and was released in November 2011. The plugin works with Java 6, if you require Java 5 then you are advised to stay on 1.16 or lower. It has known issues. 

Requirements for Plugin-Use
Jenkins 1.392 or newer and the utility plugin “instant-messaging” (called “Instant Messaging plugin”).
 

How to Use it?
Jabber is a popular chat protocol and Google Talk implements it. To demonstrate the use of the Jabber plugin I will use Google Talk. With Google Talk, Jenkins will communicate with a particular Google email id. You can also use any of the Jabber services to setup a chat room instead of 1-1 communication. 
 
Step-by-Step Instructions on How to Use the Jabber Plugin
 
Installation
  1. Go to your Jenkins instances root page.
  2. If your Jenkins instance has security enabled, login as a user who has the Overall | Administer permission.
  3. Select the Manage Jenkins link on the left-hand side of the screen.
  4. Select the Manage Plugins link.
  5. On the Available tab, select the Jabber and Instant Messaging Plugin and click the Download and Install button at the bottom of the page.
  6. (If you are using a version of Jenkins prior to 1.442) Restart Jenkins once the plugins are downloaded.

Configuration

System level configuration
  1. Go to your Jenkins instances root page.
  2. If your Jenkins instance has security enabled, login as a user who has the Overall | Administer permission.
  3. Select the Manage Jenkins link on the left-hand side of the screen.
  4. Select the Configure System link on the top of the screen.
  5. Click Enable Jabber Notification, enter Jabber Id (email id for Google Talk) and Password
  6. Add talk.google.com for Server and 5223 for Port; disable Enable SASL authentication (Google Talk gives a problem with this setting on)
  7. Enter the string in the Bot command prefix that you will like to use to communicate with Jenkins.

Job level configuration

  1. Go to your Jenkins instances root page. Click on the job that you want to configure. 
  2. Click on Configure on the left-hand side of the screen.
  3. Under Post Build Actions, enable Jabber Notification and under Targets enter the email address that you want notifications to go to.
  4. The Advanced section has additional options that control the granularity of messages (such as only failures, all or message on build starts) that can be turned on as desired.

Usage
If you run the job through Jenkins, you will see a message pop up on Google chat with the job status.  Jenkins has a sense of humor as well.  If there are no jobs running, then Jenkins will tell you that it is bored.

image

So lets give Jenkins some work by interacting with the chat client. The command prefix !jenkins identifies a chat message as a command and is configurable from the Jabber configuration section of the main Jenkins configuration page. Here is a snapshot of a number of commands that I gave Jenkins via chat.

command prefix !jenkins

 

How to Use the Plugins on DEV@cloud/RUN@cloud?
The Jabber plugin can be installed DEV@cloud Enterprise accounts by filing a support ticket and it can be used in the same manner as with any other Jenkins deployment.

Relevant Documentation

 

Harpreet Singh, Senior Director Product Management
CloudBees
www.cloudbees.com