In this post we want to discuss how Jenkins can be integrated with the Management Center for WebSphere Commerce. We will review a custom implementation of a tool for Management Center and how it can be configured and used your workspace. All relevant code is available on GitHub.

Jenkins Integration Tool

The goal of the tool is to be able to request information from Jenkins and to run builds for jobs. In order to communicate with Jenkins, we implement a custom controller command. This command can be executed in two different ways: Via the Management Center user interface and by a REST call. The REST call is not strictly needed for the tool, but can be useful during development. If you do not need REST capabilities for the command, you can ignore classes and configurations that have explicitly to do with making a REST call.

Get Started

To use the tool, import the git repository files (or relevant parts of them) into your workspace.

  • If you have existing customizations in your workspace, take care to not overwrite them, and only copy relevant sections of the following files:
    • LOBTools/WebContent/WEB-INF/spring-extension.xml
    • LOBTools/WebContent/WEB-INF/src/xml/commerce/shell/ApplicationMenuItems.xml
    • Rest/WebContent/WEB-INF/config/resources-ext.properties
  • In order to execute the Jenkins command as a REST service, we need an access policy in place. Copy the files in DataLoad/xml, to a similar location in the xml folder outside of the workspace (where the rest of the access policies are located). Then load it to the database, by using the acpload.bat script.

Configurations

The tool reads configurations from the STORECONF database table:

To insert data into the STORECONF table, use commands similar to

where, the string ThisIsMyHostName is the host name of the Jenkins server.

Usage

Once the files have been added to the workspace and configurations loaded into the database, the tool is ready to be used. Start up the WebSphere Commerce application and access the Management Center. The following images visualize how the tool functions.

Open WebSphere Management Center and select the Integration Tool from the Menu.

Select the Jenkins object in the Explorer view.

This will display a list of all the available jobs on the Jenkins server, along with some basic information about it. Select a job to see the detailed properites view.

When an object is selected we can execute a build of the job by clicking on the Jenkins build button. We can also refresh the information by clicking on the refresh button in the toolbar. Note that in order to view the console log information the job must be manually refreshed.

Conclusion

We have discussed how to add a custom Jenkins integration tool to WebSphere Management Center and how to use the tool to manage certain Jenkins tasks directly from WC Management Center This is just one example of how one can customize WebSphere Management Center to do all sorts of different tasks. This can add value to business users by decreasing the amount of different tools and simplifying their workflow. Get access to all the relevant code on GitHub.