Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hudson -CI Screen saver setup

HI , Is there any I can setup a screen saver with the list of projects running in hudson which indicates the status of the project. Say the part of the screen saver indicates green for projects got succeded , and shows the red if the project is failed to build.

Probably the screen saver must be partitioned to multiple projects !!!

like image 934
srinannapa Avatar asked Oct 12 '10 06:10

srinannapa


2 Answers

You can create something in any suitable environment e.g. Flex / AS3. that can read XML and also generate the sort of screensaver design and executable you need (depending on your target platform)

You could just create to a straightforward webpage and consume the hudson data over AJAX, and render your display in HTML/CSS, it's up to you, but it's fairly trivial to do.

Hudson will provide the current list of jobs and their status color over it's basic API (XML in this example)

http://hostname:8080/api/xml 

Will yield something like...

 <hudson>
   <assignedLabel></assignedLabel>
   <mode>NORMAL</mode>
   <nodeDescription>the master Hudson node</nodeDescription>
   <nodeName></nodeName>
   <numExecutors>5</numExecutors>
   <job>
     <name>JobOne</name>
     <url>http://hostname:8080/job/JobOne/</url>
     <color>blue</color>
   </job>
   <job>
     <name>JobTwo</name>
     <url>http://hostname:8080/job/JobTwo/</url>
     <color>blue</color>
   </job>
   <job>
     <name>JobThree</name>
     <url>http://hostname:8080/job/JobThree/</url>
     <color>blue</color>
   </job>
   <overallLoad></overallLoad>
   <primaryView>
     <name>All</name>
     <url>http://hostname:8080/</url>
   </primaryView>
   <slaveAgentPort>0</slaveAgentPort>
   <useCrumbs>false</useCrumbs>
   <useSecurity>true</useSecurity>
   <view>
     <name>All</name>
     <url>http://hostname:8080/</url>
   </view>
   <view>
     <name>Dashboard</name>
     <url>http://hostname:8080/view/Dashboard/</url>
   </view>
 </hudson>

You'd be interested in these nodes...

   <job>
     <name>JobOne</name>
     <url>http://hostname:8080/job/JobOne/</url>
     <color>blue</color>
   </job>
   <job>
     <name>JobTwo</name>
     <url>http://hostname:8080/job/JobTwo/</url>
     <color>blue</color>
   </job>
   <job>
     <name>JobThree</name>
     <url>http://hostname:8080/job/JobThree/</url>
     <color>blue</color>
   </job>

Which would be easy to select and get the required color (build status is red or blue) and job name. If you want more info I'd be happy to throw something basic together.

Update: Very Basic Flex Example.

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
xmlns="*" creationComplete="start()">

    <!-- The HTTPService request -->
    <mx:HTTPService id="jobsRequest" url="http://localhost:8080/api/xml" useProxy="false" method="POST">
        <mx:request xmlns="">
        </mx:request>
    </mx:HTTPService>

    <!-- basic timer to trigger the data request from Hudson -->
    <mx:Script>
        <![CDATA[
            import flash.utils.Timer;
            import flash.events.TimerEvent;

            private var t:Timer = new Timer(5000, 0); // repeat every 5 seconds;

            private function start():void {
              t.addEventListener(TimerEvent.TIMER, getHudsonStatus);
              t.start();
            }

            private function getHudsonStatus(e:TimerEvent):void {
                jobsRequest.send();
            }
        ]]>
    </mx:Script>

    <!-- the view -->
    <mx:DataGrid id="hudsonJobsDataGrid" x="22" y="128" dataProvider="{jobsRequest.lastResult.hudson.job}">
        <mx:columns>
            <mx:DataGridColumn headerText="Name" dataField="status"/>
            <mx:DataGridColumn headerText="Status" dataField="color"/>
        </mx:columns>
    </mx:DataGrid>

</mx:Application>

This is pretty crappy, but it's doing the data retrieval you need, Flex 4 or Silverlight will give you better data driven lists, with ItemRenders (Flex4 Spark) or DataTemplates (Silverlight), I think the Flex4 route will require less code, and if it MUST be a screensaver, it's fairly simple to convert SWF's to Screensavers, and a lot of tools are available to automate the process.

Update 2: Slightly better Flex 4 example...

I've created a nicer view as a fullscreen AIR Application with Flex 4 using Spark components (DataGroup + ItemRenderer) it's here http://gist.github.com/623167 as source. Flashbuilder4 or the AIR SDK is required to build it. It's not a finished product of course!

It looks like this... : http://i.stack.imgur.com/8I92U.png - when it was monitoring http://deadlock.netbeans.org/hudson

like image 143
ocodo Avatar answered Oct 05 '22 15:10

ocodo


Install the Radiator View plugin for Hudson; this should provide the functionality you want.

like image 26
Christopher Orr Avatar answered Oct 05 '22 14:10

Christopher Orr