WebSphere Commerce – Management Center: Jenkins integrationby Rúnar Sverrisson, March 26, 2020
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.
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:
- 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
xmlfolder 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.
The tool reads configurations from the
STORECONF database table:
integration.jenkins.hostName, integration.jenkins.port, integration.jenkins.username, integration.jenkins.password
To insert data into the
STORECONF table, use commands similar to
INSERT INTO WCS.STORECONF (STOREENT_ID, NAME, VALUE, OPTCOUNTER) VALUES(0, 'integration.jenkins.hostName', 'ThisIsMyHostName', 1);
where, the string
ThisIsMyHostName is the host name of the Jenkins server.
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.[caption id="attachment_53983" align="aligncenter" width="1828"] 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.
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.