It is ridiculously easy to enable controling CC using the JMX (Java Mananagement eXtensions) api. Here's what you get :
- the ability to pause the build loop
- the ability to resume the build loop
- the ability to force a build to occur NOW
- edit various run-time parameters, like build interval, log dir, config file, etc
- countless other features that are being dreamed up as you read this
All without killing/editing/restarting the java app.
How to enable the JMX server
Pass -jmxport ### on the CC command line. It's that easy! Pick a port > 1024 that is not in use on your server.
How to view/modify paramters, pause/resume, and force builds
After CC starts up, point your favorite webbrowser at http://YOURSERVER:YOURPORT. You will be greeted with the JMX Agent View page. You want to click on the "Cruise Control Manager".
You may also view the JMX console through the CruiseControl Web app. Edit the controlpanel.jsp under the cruisecontrol Web application root. There's an <iframe/> tag with a src attribute like so:
src="http://<%= hostname %>:8000"
Edit the port value to match the port on which you started cruisecontrol (or just use port 8000!). You could further hack this by setting the port value as a context param in the web.xml and getting it dynamically in the controlpanel.jsp.
This page is the standard mBean control view. It provides a window into your application (in this case, CC). Scroll to the bottom for the main functions (pause/resume/force build).
If you use CruiseControl out of CVS and have now multi-project functionality, you have to click on one of your projects in the "CruiseControl Project" sequence. There you will found on bottom the main functions (pause, build and resume). So if you click to build, the current project will build now.
You can change any of the RW access properties by editing them and pressing the "Apply" button. This can be helpful when changing the project's label or to reset the lastBuild or lastBuildSuccessful properties. If you think it's useful to persist the changes you should serialize the project afterwards.
How to improve the controlling of CruiseControl
If you really have tried the steps above, you'll notice that becausee it is a standard JMX web interface, all the projects-related information are hard to find. Even though '... is ridiculously easy to enable controling CC using the JMX...', it is rediculously hard to like it.
The following should be the proper user interface design.
When a user access the control panel, the first thing it should show is the status of the build. This should be right on the top in a recognizable style. Below should be the most frequently used functions: force build, pause build, etc. At the bottom should be the less commonly used functions, i.e., setting of the builld.
The following are the potential ways to achieve this:
1. Nicer HTML front-end for JMX
Does anyone want to tackle creating a nice html front-end to inteface with the JMX? That would be very sweet (perhaps it is already under development in the jsp reporting app?). See http://webjmx.sourceforge.net/ .
You can customize the xsl files through the -xslpath switch and provide the directory that contains all the XSL files
If you have more info, add the details here! -JonathanJulian
– [MattAlbrecht]
I've just started experimenting with jManage and CruiseControl.
– Jerome Lacoste
2. RMI controller
I've been looking at replacing the standard Web JMX controller with an RMI controller, so that it could integrate easier with the reporting JSP pages. This would allow for several advantages:
- The current build status would reference the JMX control instead of a file.
- Control Panel would have access to pause/resume/build functions.
– [MattAlbrecht]
For earlier version of JMX:
I did take a look at the -rmiport switch. It only registers a MBean that controls the RMI registration. You'll have to write your own RMI classes, register them, and compile them using rmic. Just sounds like a lot of hassle.
See Example RMI Controller
– Shane Duan on mailing list
For JMX with Remote API (JSR 160):
Not quite. You would connect to the RMI server by creating a JMXServiceURL that points to your RMI server and use the JMXConnectorFactory to get an instance JMXConnector which contains a reference to the RemoteMBeanServer. With this you have nearly the same API as you would from an MBean local to the MBeanServer in CC.
I usually use cruisecontrol.jar directly in my client and have written a generic RemoteMBeanFactory to create a dynamic proxy for whatever MBean interface I want. It is dead simple and allows me to interact with remote MBeans as if my client were in CC.
– Michael Beauregard
3. XML interface
An XML interface from CruiseControl server and leave the implementation of UI to a client.
Apprantly you can register an HttpAdaptor without any XSLT processor, which will serve XML response instead of HTML. Then it is possible to build a set of classes that can parse these files and control the server. This is kind of like web services. This will make it easy to write a control panel on the build page, and the code can be reused to write plug-in for any IDEs.
In order not to give up on the current JMX control, which provides a compmlete list, a switch, '-xmlport' can be added to the command line interface.
– Shane Duan