2

All,

We have a testing application which creates its own reports in a web dashboard that we would like to have added to the Hudson project page for builds. At present the application outputs the URL to the page for that build into the console log.

What I would like to do is pull the URL out of the console log and then have the content at the URL end point added to the project page for that build (IFrame perhaps?).

Is there a simple way to do this? Existing plugin perhaps? Possibly config that I've overlooked? I'm coming to Hudson from Cruisecontrol and I'm still getting to grips with the differences.

Thanks.

MrChris
  • 117
  • 7

2 Answers2

1

It should be possible to script the editing of the build description by HTTP POST:ing the form at ${BUILD_URL}/submitDescription:

curl --data description="<a href=\"http://foo.bar.com\">foo</a>" ${BUILD_URL}/submitDescription

The build description will show up in the left-hand build history, so you might want to keep it short.

Anders Lindahl
  • 41,582
  • 9
  • 89
  • 93
  • Apologies, I may not have described the problem sufficiently. I'm looking to add the content to the main body of the page, not just tag the build (which is effectively what adding to the build history is doing). Some plugins contribute graphs etc under the assets/changes section. I would like to contribute content at that location, but from an external website - the URL for which I retrieve from the Console Output. From what I can tell this would have to be a java plugin, am I correct? Are there existing plugins for this sort of thing? It would seem like a common request to me.. – MrChris Aug 22 '11 at 18:53
1

In the end the solution to this that I went with was to create a custom plugin, which parsed the console log building an ArrayList of URLs, and contributed an 'action' into the top left column. From there I could pull each URL from my 'bean' (ArrayList wrapper effectively). After that it was just a chunk of Jelly to create each iFrame in the Jenkins page. I did add some Javascript to the Jelly page however as the default height of the iFrames wasn't useful to me.

Jelly:

<script type="text/javascript">
 function resizeFrame(f) {
  var i = document.getElementById(f);
  var s;
  s = 100;
  i.style.height = s;
  s = i.document.body.clientHeight;
  //Some odd Javascript re-sizing here, works fine in the debugger..
  var ss = s/2.5;
  i.style.height = ss+"px";
}
</script>

<table width='100%'>
   <j:forEach items="${it.result.getHtmlLogPath()}" var="i" indexVar="index">
    <tr>
       <td width='100%'>    
         <iframe id="myFrame${index}" src="${i}" width="100%" frameborder="0" onload="resizeFrame('myFrame${index}');"/>
       </td>
    </tr>
  </j:forEach>
</table>    

This is working for my basic requirements at the moment, if I get a chance I'll genericize the plugin for other to work with.

MrChris
  • 117
  • 7