Hudson -CI Screen saver setup

2019-04-25 09:50发布

问题:

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

回答1:

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



回答2:

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



回答3:

You can try a build radiator like Buildron. It supports Hudson too and is very cool way to keep the whole team updated about the builds status.

besides the 3D environment, it has sound and a mobile app for iOS and Android where you can interact with it.



回答4:

Team Build Screen would do exactly what you need, but currently only supports TFS 2008/2010. Fortunately I am presently working on version 1.4.0 which includes support for Hudson. If you are interested, keep an eye on the latest source code: http://teambuildscreen.codeplex.com/SourceControl/list/changesets. Basic support has been checked in but has not yet been wrapped up into a release.

You can download the source and build it yourself, the project is called TeamBuildScreen.DesktopHudson.

More details about the project can be found at: http://teambuildscreen.codeplex.com/