Blogs as extreme feedback devices

I've already talked about how we're using a project blog, but I made a quick change the other day so that we could use it as an (almost) extreme feedback device.


Figure 1 : Happy build


Figure 2 : Sad build

If you're running a Pebble multi-user instance, the trick here is to drop some code into your templates (/common/jsp/template.jsp and /themes/default/jsp/template.jsp) to redefine some of the CSS styles.

<%
  SimpleBlog buildBlog = BlogManager.getInstance().getBlog("build");
  List blogEntries = buildBlog.getRecentBlogEntries(1);
  if (blogEntries.size() > 0) {
    BlogEntry blogEntry = (BlogEntry)blogEntries.get(0);
    if (blogEntry.getTitle().matches(".*Build Failed.*")) {
%>
      <style type="text/css">
        .header {
          background : #CC0000;
          color: white;
          background-position: center;
          background-repeat: no-repeat;
          font-weight: bold;
        }
        .footer {
          background: #CC0000;
          color: white;
          font-size: 11px;
          font-weight: bold;
        }
        a:link, a:visited, a:active {
          color: #CC0000;
          text-decoration: none;
          font-weight: bold;
        }
      </style>
<%
    } else {
%>
      <style type="text/css">
        a:link, a:visited, a:active {
          color: #00CC00;
          text-decoration: none;
          font-weight: bold;
        }
        .header {
          background : #00CC00;
          color: white;
          background-position: center;
          background-repeat: no-repeat;
          font-weight: bold;
        }
        .footer {
          background: #00CC00;
          color: white;
          font-size: 11px;
          font-weight: bold;
        }
      </style>
<%
    }
  }
%>

I've also added a meta-refresh to the multi-user template so that we can leave the blog sitting in a browser window, reloading every few minutes.

<META HTTP-EQUIV=Refresh CONTENT="600; URL=<c:out value="${blog.url}"/>">

Not very subtle colours but they work!



Re: Blogs as extreme feedback devices

Brilliant :)

How are you posting CC build results to the blog, by the way?

Re: Blogs as extreme feedback devices

I'm using your publisher! (see here).

Re: Blogs as extreme feedback devices

Cool. Now how can that be done without hardcoding the blog name? Let's say I have 5 projects, and they all have project blogs - A, ABuild, B, BBuild... etc Good logic would be that it introspects the *current* blog, and does the extreme colors if blog name contains "build". Guess this could be pulled in with a javascript include to be more modular, as well.

Re: Blogs as extreme feedback devices

The current blog is already exposed through a variable called "blog", and you can get the name of it using the getId() method. You could even iterate over all blogs to find any CruiseControl failure messages. BTW, I'm going to include a version of this in the next Pebble release that can be used as a starting point.

Re: Blogs as extreme feedback devices

nice. didn't realize, just installed pebble today :)

Add a comment Send a TrackBack