views:

60

answers:

1

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 !!!

+4  A: 

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/&lt;/url&gt;
     <color>blue</color>
   </job>
   <job>
     <name>JobTwo</name>
     <url>http://hostname:8080/job/JobTwo/&lt;/url&gt;
     <color>blue</color>
   </job>
   <job>
     <name>JobThree</name>
     <url>http://hostname:8080/job/JobThree/&lt;/url&gt;
     <color>blue</color>
   </job>
   <overallLoad></overallLoad>
   <primaryView>
     <name>All</name>
     <url>http://hostname:8080/&lt;/url&gt;
   </primaryView>
   <slaveAgentPort>0</slaveAgentPort>
   <useCrumbs>false</useCrumbs>
   <useSecurity>true</useSecurity>
   <view>
     <name>All</name>
     <url>http://hostname:8080/&lt;/url&gt;
   </view>
   <view>
     <name>Dashboard</name>
     <url>http://hostname:8080/view/Dashboard/&lt;/url&gt;
   </view>
 </hudson>

You'd be interested in these nodes...

   <job>
     <name>JobOne</name>
     <url>http://hostname:8080/job/JobOne/&lt;/url&gt;
     <color>blue</color>
   </job>
   <job>
     <name>JobTwo</name>
     <url>http://hostname:8080/job/JobTwo/&lt;/url&gt;
     <color>blue</color>
   </job>
   <job>
     <name>JobThree</name>
     <url>http://hostname:8080/job/JobThree/&lt;/url&gt;
     <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.imgur.com/8I92U.png - when it was monitoring http://deadlock.netbeans.org/hudson

slomojo
very good answer (+1)
seanizer
@slomojo : Is there any plugin already built in which prepares ,say a screensaver for us
srinannapa
@srinannapa - There isn't, but the Flex example should help you out a bit, I'd say it was the simplest way to go, and the compiler is free. The second best way would be to render the results to HTML.
slomojo
@slomojo : What is the extention of above xml file. What do we need to run the above stuff?
srinannapa
@srinannapa - I would suggest you start by being able to consume the Hudson server api/xml feed with a JavaScript AJAX call (I'd recommend using JQuery) ... so that you can build an HTML view of the Hudson Job statuses. If you don't know Flex, there are many resources online where you can find out how to build a basic App, the file in my update should be saved as an .mxml file - download the trial of FlashBuilder4 and start a new Flex application project and paste the code into a new MXML Application file and build it. FlashBuilder will also help you build a better ItemRenderer based view.
slomojo
There are enough plugins, that give you this functionality, but not as a screen saver. I suggest you just disable the screen saver and have the one page open all the time.
Peter Schuetze
GiyF: Use http://www.web-screen-saver.com/download.html and `eXtreme Feedback Panel Plugin` or the `Radiator view plaugin` (http://wiki.hudson-ci.org/display/HUDSON/eXtreme+Feedback+Panel+Plugin and http://wiki.hudson-ci.org/display/HUDSON/Radiator+View+Plugin ) Since the screen saver is not for free, it will cost you 20 Dollars for the screen saver and a few minutes to set this up.
Peter Schuetze