[Buildbot-commits] [Buildbot] #1863: Make it easier to embed current build status into external web pages

Buildbot nobody at buildbot.net
Thu Mar 10 10:01:51 UTC 2011


#1863: Make it easier to embed current build status into external web pages
------------------------+------------------------
Reporter:  deng         |       Owner:
    Type:  enhancement  |      Status:  new
Priority:  minor        |   Milestone:  undecided
 Version:  0.8.3p1      |  Resolution:
Keywords:               |
------------------------+------------------------

Comment (by marcusl):

 What we've done is to fetch the HTML using AJAX and embed it into a <div>
 tag on the site. This requires the CSS to be modified to style buildbot's
 HTML correctly, but it works pretty well for us.


 {{{
 #!js
 fetch_buildbot = function(id)
 {
   var build_html = function(data, data2) {
     var list = $("tr", $(data2));

     var table = list.wrapAll("<table cellpadding=4 style='text-
 align:center'><\/table>").parent().parent();
     $("#buildbot_" + id + "_status").html(table);

     var list2 = $("tr", $(data2));
     var status = $("#buildbot_" + id + "_status");

     var heading = status.prev();
     heading.attr('class', $("tr:last > td:last", status).attr('class'));

     status.find("a").each(function(i) {
       if ($(this).attr("href").indexOf("http") == -1) {
         this.href = "/buildbot/" + id + "/" + $(this).attr("href");
       }
     });

     $('#load_' + id).hide();
   };

   $('#load_' + id).show();

   $.get("/buildbot/" + id + "/tgrid", function(data2) { build_html("",
 data2); });
 }

 ...
 reload = function(x)
 {
   fetch_buildbot("web");
   fetch_buildbot(...);

   ...
 }

 $(document).ready(function() {
     reload();
     $(document).everyTime("30s", function() { reload(); });
 });
 }}}

 And then the HTML has div with a correspodning id:
 {{{
 #!xml
 <div class="buildbox">
   <h2><a href="buildbot/web/">Buildbot Web</a></h2>
   <div id="buildbot_web_status"></div>
 </div>
 }}}

 It works pretty well since this page is on the same server. (We proxy our
 buildbot's webstatus's via Apache)

-- 
Ticket URL: <http://trac.buildbot.net/ticket/1863#comment:2>
Buildbot <http://buildbot.net/>
Buildbot: build/test automation


More information about the Commits mailing list