Thursday, March 22, 2012

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.

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.

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
 
Follow CloudBees:
Facebook Twitter

2 comments:

  1. Hi Harpreet,

    Thanks for the post. I managed to get it working nice & easily with a few tweaks to your post. I found I had to use port 5222 rather than port 5223 as you specified. This is documented here - http://support.google.com/talk/bin/answer.py?hl=en&answer=27930. Very important to note that anyone behind a proxy will almost definitely need to use port 443 instead of 5222.

    Thanks again,
    Jimmi

    ReplyDelete
  2. It does not work for Adium. I kept getting error of:

    Jabber notifier plugin: [ERROR] not connected. Cannot send message to

    my JID is my company email. And I have put my company's Jabber server in Jenkins configuration. However the google talk one works. But I need to have the Adium one work since google talk account I created do not have permission for Jenkins jobs.

    ReplyDelete