Archive

Archive for August, 2009

One Year On

23 August, 2009 1 comment

Happy anniversary! Yes, my first post on this blog was one year ago! That was when I first adventured into the wonderful world of open source and embarked on enhancing and improving CruiseControl.NET.

Since then a lot of things have changed! Here are some of the highlights:

  • I have a son (he’s almost five months old now!)
  • I’ve written 178 posts
  • I’ve changed 60 thousand lines of code (wow!)
  • I’ve added a new application to CC.NET (CCValidator)
  • And I’ve started my own open source project (FastForward.NET)

In terms of CruiseControl.NET, I’ve added the following functionality:

  • Security
  • Dynamic build values and parameters
  • Message-based communications
  • Common communications client
  • Monitor API
  • NDepend and NCover tasks
  • Image and HTML support in the dashboard
  • Packages
  • Hot-swapping
  • Parallel and sequential tasks
  • Task statuses

Plus I’ve gotten to know a great bunch of people, and learnt a lot about coding and development.

So, all in all, one year down the line, I think it has been very much worth it :D

Here’s to another year!!!

FastForward.NET: Beta 3 Released

22 August, 2009 3 comments

Yes, I’ve managed to stick to my weekly release schedule – I have just posted the binaries for the third beta. As well as expanding the installer to include the build templates and release notes, the following items have been added/fixed:

  • Added a properties display for projects, servers and build queues
  • Added global error handling and reporting
  • Save the position of pop-up windows so they can be restored when re-opened
  • Remove the next build date display if a project does not have a next build time
  • Standardised on how the server name is generated – should now always display the local name
  • Added the server name to the build visualisations
  • Fixed bug where plug-ins can be duplicated
  • Plug-ins can now hide the application instead of closing
  • Added estimated time of completion

This release is now a lot more stable – I have been able to run it for the entire day on machine without any crashes. However, if you find any issues, let me know :-)

The binaries can be downloaded from https://www.ohloh.net/p/FastForwardNET/download.

Categories: FastForward.NET Tags:

FastForward.NET: Error Handling

21 August, 2009 1 comment

Oh No, It’s Crashed!

It’s hard building real-world software. Not that writing software is hard, no it’s the “real-world” part that is hard! Why? Because the real world is messy!

I’m not talking about a little bit of mud or slime that can be easily wiped off, no, I’m talking about your kids haven’t cleaned their bedrooms in a year and they can’t that check they were supposed to bank three months ago messy. Times that by a hundred kids, in different countries, some of whom don’t even understand you!!

Not that I’m advocating sloppy coding, but sometimes, no matter how beautiful the code is, things just break. For no apparent reason (yes, I know it worked on your machine when you wrote it.) That’s why someone coined the term defensive programming. And like all developers, my code needs defensive code just as much.

Hence, in the next release I’ve added some error handling code.

You Mean It Isn’t Perfect?

Yes, FastForward.NET isn’t perfect :-(

So I have added a generic handler for all unhandled exceptions (yes there are place were I expect problems and have error handling in place.) If one of these errors occur you’ll get a message like this:

image

This tells you there was an error, it logs the details and tells you where and then advises shutting down the application. I could have been mean and just killed the application, but I’ll give you the choice (it is highly recommended though!)

What’s in the Log?

The reason I generate the logs, is it is nice to get some data on what caused the crash. So, here is an example log:

  1: <?xml version="1.0" encoding="utf-8"?>
  2: <errorLog>
  3:   <environment time="2009-08-19T19:23:00.2808000+12:00" 
  4:                os="Microsoft Windows NT 6.0.6001 Service Pack 1" 
  5:                processors="2" 
  6:                clr="2.0.50727.3074" />
  7:   <error type="System.Exception">
  8:     <message>Hey, you've broken something!</message>
  9:     <stack>
 10:       at FastForward.Monitor.Plugins.BuildVisualisationDisplay.OnMouseDown(MouseEventArgs e) in C:\Open Source\FastForward.NET\trunk\project\FastForward.Monitor\Plugins\BuildVisualisationDisplay.cs:line 136
 11:       at System.Windows.Forms.Control.WmMouseDown(Message&amp; m, MouseButtons button, Int32 clicks)
 12:       at System.Windows.Forms.Control.WndProc(Message&amp; m)
 13:       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message&amp; m)
 14:       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message&amp; m)
 15:       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
 16:       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG&amp; msg)
 17:       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
 18:       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
 19:       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
 20:       at System.Windows.Forms.Application.Run(ApplicationContext context)
 21:       at FastForward.Monitor.Program.Main() in C:\Open Source\FastForward.NET\trunk\project\FastForward.Monitor\Program.cs:line 46
 22:       at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
 23:       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
 24:       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
 25:       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
 26:       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
 27:       at System.Threading.ThreadHelper.ThreadStart()
 28:     </stack>
 29:   </error>
 30: </errorLog>

As you see, there’s nothing confidential :-) So it would be nice if you get one of these, if you could post it in the error report on Trac.

And of course, feel free to add any additional information you think would be helpful. I promise I will try to resolve any issues as fast as possible.

Categories: FastForward.NET Tags:

FastForward.VisualStudio

The Concept

As part of the FastForward.NET suite, I am planning on adding a Visual Studio plug-in. This plug-in will allow developers to interact with one or more CruiseControl.NET servers from the comfort of their IDE :-)

My current plan is to include the following items:

  • Projects view tool window
  • Queues view tool window
  • Server explorer tool window
  • Build report document

Plus I would also like to add some options for working with configuration files:

  • Intellisense
  • A configuration editor (maybe using a DSL)

And maybe even expand the configuration API so it is possible to configure a CruiseControl.NET server from within VSIDE – yes, I definitely have some fun ideas ;-)

A Reality Check

Before everyone starts getting excited (including myself), I must warn people I am not a Visual Studio developer – this will be my first attempt at building a proper plug-in for Visual Studio.

When I first started on FastForward.NET I planned on releasing the Visual Studio and Monitor components at the same time – after all, they can use a lot of the same underlying infrastructure. Unfortunately my experiments with building Visual Studio plug-in rather discouraged me and so I kind of gave up. COM interop, resource issues, trying to get things appearing in the right place – it all seemed too much for just a hobby project.

However, all was not lost, I discovered VSSDK – a managed API for building plug-ins. So I will be trying to implement the plug-in using this instead of directly working with Visual Studio and COM. This will mean a bit of learning for me, but so far I have had more success than I had previously!

Progress to Date

I’ve got to admit, not a lot :-(

I’ve been playing around with VSSDK in my spare time (in between improving the Monitor and fixing issues.) I like to try and understand what I am doing, as that helps resolve weird issues that come up later if I just copy and paste.

The good news, is I finally have a tool window working in Visual Studio:

image

This can be configured to load or remove servers.

Unfortunately, I am missing something somewhere, as all my menu commands are duplicating or worse:

image

*sigh*, some things are not as easy as you would think!

This is not ready to release as part of the installer yet, not even as an “experimental” feature, but the code is in Subversion. So, if anyone is feeling brave, feel free to download it, build it and give it a test run. Of course, I’m more than happy to receive advise on how to do things ;-)

I am aiming to have an initial release early October, so stay tuned…

Why Targets?

This post is the answer to a question I was asked recently.

The Question

Looking at the add server window, there is an address field and a target server field:

Initial-7a

The question was why are both necessary?

The Answer

The answer to this question lies in the way the different components of CruiseControl.NET (CC.NET) communicate. The following picture shows the components and their interactions:

Communications

What we are really interested in monitoring is the CC.NET. However, the server is not always what is connected to. It is only a direct connection if .NET Remoting is used (or a custom protocol). If someone is connecting via the web dashboard, the address they enter is the address of the dashboard, not the CC.NET server.

Since we want to monitor the actual server, not the dashboard, the target server field is required. This tells the dashboard that although it has received a request, the request for for an actual CC.NET server and needs to be passed on.

Now, in CCTray this field is not needed. But then a lot of the functionality in CCTray is only available for a .NET Remoting connection – they will fail on a HTTP connection. And this is exactly the reason why they fail – the dashboard guesses which server the request should be sent to, and it can’t always get the right server!

Related Questions

This leads to a few other questions:

1: What is the target server for a dashboard connection?

In the dashboard, it displays the available target servers:

Dashboard-Farm

The available servers are listed on the left under the heading “Servers”.

2: What is the target server for a .NET Remoting connection?

Currently this is ignored, but in future CC.NET may handle routing to other servers (i.e. in a farm scenario). Therefore, this should be left as “local”. This will tell CC.NET that the request is for the local server and should not be passed on.

3: Is there a way of listing the servers in the monitor?

At the moment CC.NET does not provide a list of possible target servers. This needs to be added to CC.NET first (i.e. in the dashboard) and then I can add the listing to the monitor.

This is on the to-do list, but first I need to resolve some of the other issues in FastForward.NET.

4: If I want to monitor multiple CC.NET servers that are on one dashboard, do I need to add them individually?

Yes. FastForward.NET monitors the individual servers – not the dashboard.

In future I may add the ability to monitor a dashboard instead of the individual servers – but this means the interactions that are currently provided will be more limited (i.e. to what is allowed by the dashboard).

Categories: FastForward.NET Tags:

FastForward.Cache – An Experiment in Availability

The Idea

This is another idea that I am playing around with under the FastForward.NET banner – a cache service. Before I go into how I am implementing the cache, first lets look at how clients communicate with a CruiseControl.NET server.

Some Background

A CruiseControl.NET (CC.NET) server only natively supports one protocol – .NET Remoting. So, in order to connect to the server a client must use .NET Remoting.

But, you say, what about HTTP? Yes, it appears that CC.NET has an HTTP protocol, but this is actually done via the web dashboard. This is a separate application that runs in a web server, which connects to the actual CC.NET server via .NET Remoting.

Additionally, with CC.NET 1.4.4 or later, it is possible to add a custom extension that adds a new protocol – not that I am aware of anyone doing this yet.

So, the following options are available:

image

Often the web dashboard and the CC.NET server will be on the same machine, but there is no requirement for this. Additionally, a single dashboard can be the front-end for multiple CC.NET servers – providing more functionality and more complexity to the mix!

How, if all of these are on a single network, which is reasonably fast, this infrastructure is not a problem. But add a bit of network lag, or a large number of servers, and suddenly things will slow right down.

One Scenario

To show what I am proposing as a solution, I want to look at a reasonably simple scenario. In this scenario we have five CC.NET servers that need to be monitored. These are all monitored by a single dashboard, and the client then connects to the dashboard to see the project details:

image

(Yes, I did choose FastForward.NET Monitor as the client :-) )

Whenever the client wants to get the status of the servers, it will send a request to the dashboard. The dashboard then sequentially goes through and sends a request to each of the servers, then finally send the response to the client. Now imagine there is a 0.25s lag in connecting to each server – it would take 3s just to get one response back to the client (2.5s for the dashboard to query all the servers, plus the lag between the client and the dashboard)!

Now, expand that out slightly – imagine three clients:

image

The dashboard does not cache any results – so every time a client wants to refresh the status it has to go through the process of querying each server. So, with the default polling interval for FastForward.NET (and CCTray as well), this means the dashboard is going to be asking at least one of the CC.NET servers for its status at any point in time!

Now a .25s lag might seam like a lot, but over an Internet connection this is not at all unreasonable (actually, with some of the dashboards I connect to, a 0.25s lag would be very quick!)

The problem in this scenario is the dashboard just acts as a pass-through layer – it doesn’t provide any value on its own. And that’s just for status upgrades – there are also all the other items that CC.NET provides (e.g. build logs, RSS feeds, etc.)

Instead, what I am thinking of is to replace the dashboard as the intermediate server. Instead there would be the FastForward.NET cache service:

image

This looks very similar to the previous picture, but with one major difference – the cache service would have a local database.

Now, if we open up the hood of the cache service, it will work something like this:

image

When a client wants to request some data, the request comes in over a client connection (1). The client connection receives the request and checks the local database to see if the data is there (2). If the data is there, then this data is used (3). Otherwise a request is sent to the server connections for the data (4). This request gets passed on the server (or servers) (5). When the data is received it is stored in the database (6) as well as being passed back to the client.

This would be the standard model for most requests – for status requests it would be possible to have an additional disconnect:

image

In this model, there is only the client connection loop (1-3) – if there is no data in the local database then no status information will be returned to the client. Instead, the server connections will be constantly polling the CC.NET servers (a) and then storing the status information in the local database (b). This means when the client needs the information, they just use the local data – saves having to query one or more servers for their status.

Limitations

Of course, this model is not without its limitations. First, this would only work for retrieving data – action requests (force/abort build, start/stop project, etc.) would pass through directly to the CC.NET servers.

Second, this does not take into account security – all secure requests would again pass right-through (especially if they are encrypted).

Third, it means the data the client is getting can potentially be very out-of-date. For some data this is not an issue – e.g. build logs are only written once and then never change. Other data could be potentially very wrong – e.g. the project statuses.

Any Comments

I have already started working on a service to do this – although at the moment it is very experimental. However I do think this could have a lot of value, especially for large installations and even more so for those with slow networks (or slow Internet connections).

Does anyone have any comments?

FastForward.NET: Beta 2 Released

I have just put out a second beta of FastForward.NET: https://www.ohloh.net/p/FastForwardNET/download. This fixes a number of bugs, plus adds some error logging (still working on adding more).

I will try and release a new version every week while in beta, so let me know of any issues…

Categories: FastForward.NET Tags:

FastForward.NET: Plug-ins

14 August, 2009 2 comments

An Exciting New Area!

One of the new areas that I am excited about for the FastForward.NET monitor is plug-ins. In CCTray, new functionality was added to the core application – whether or not people wanted it. This led to an increasing number of dependencies for CCTray (SpeechLib, Growl, cm17a, etc.) If you didn’t want the functionality, tough! Additionally, these dependencies (plus some other issues) meant that CCTray would only work on a Windows machine :-(

FastForward.NET has an extension framework to allow for new, non-core functionality. This allows user to pick and choose what they want, and also means there will be a smaller set of dependencies. Additionally, plug-ins can also influence the UI – making it easy to add new nodes to the explorer or new tabs to the main window!

In this post I will cover some of existing plug-ins I have added. This is both to document how they work, and also provide some details on what can be done.

Configuring Plug-ins

All the configuration for plug-ins is done in the plug-ins tab of the settings dialog. This includes both adding or removing plug-ins, and per-plug-in configuration.

To add a new plug-in, you need to go to this tab:

Initial-5

Click on the add button, and you will be prompted to select a plug-in:

AddPlugin

The dropdown lists all the available plug-ins, plus allows you to import new plug-ins (more on this later):

AddPluginList

In the screen shot, you can see there are five plug-ins already developed . Four of these are “core” plug-ins, in that they exist within the main executable, while the fifth is an example of an “extension” plug-in – one that is outside of the core executable.

Let’s take a look at these plug-ins, what they do and how they can be configured.

Note: This is still very early days for the plug-ins, I expect they will continue to change and improve over time.

System Tray Notifications

Unlike CCTray, the FastForward.NET monitor does not offer any in-built notifications. One of the original notifications in CCTray was the system tray notifications – and so these have been added as a plug-in for the monitor.

This plug-in works in the same way as the system tray notifications in CCTray. It adds a little icon to the system tray which shows whether any builds are in process or not. Additionally, it will display pop-up notifications for various events – at the moment these events are the start and end of builds.

The following configuration options are available:

Plug-Options-1

These are all pretty simple – it just states when the notifications should be displayed.

Security Information

With CruiseControl.NET 1.5.0 security has been added. The only problem is the only place this is visible is in the dashboard. This plug-in allows some of the security information to be displayed in the monitor.

This plug-in will add a node to the server tree – to display the users – and add a new tab – to display the audit log:

Security

Of course, the server needs to be configured to have security, and the logged in user needs to have the valid security permissions, otherwise these items will be empty (like above).

Currently, the only configuration option for this plug-in is whether to display the audit log tab or not.

I’m still planning on adding extra details to this plug-in, so feel free to send any suggestions on how I can improve it.

RSS Feed Display

It is possible to configure CruiseControl.NET to generate a feed for projects. This plug-in provides an alternate way of viewing these feed. Enabling this plug-in will add a new command – View RSS Feed:

image

Clicking on the option will open the feed in a new window:

image

Otherwise, this just works like a standard feed (except without needing to go through a web server.)

There are no configuration settings for this plug-in.

Build Visualisations

I’ve already talked a little bit about this one before, but basically I wanted to test the plug-in infrastructure and so came up with this plug-in. It provides an alternate way of displaying projects (similar to BVC):

image

There are a few different configuration settings – mainly around changing the colours:

image

Currently you can only change background colours, but if there is enough demand I will also add the foreground colours. But like I said, this was just an opportunity for me to play around with some GDI+ :-)

Speech Notifications

The final plug-in is an extension plug-in – you need to copy the DLL into the plug-ins location or directly import it. The reason for this is simple – this plug-in relies on WPF, which is certainly not available in Mono (not now, maybe never).

Rather than add a dependency on SpeechLib, this uses the WPF managed interface. Like its name says, this plug-in will speak build notification events.

In many ways this is similar to the system tray plug-in – except you can choose the voice (if there are multiple voices installed):

image

That’s All…For Now

These are the plug-ins I have developed to date. I do have some plans for more, and I will also cover the inner workings of plug-ins in a future post so other people can write their own plug-ins :-)

Have fun…

Categories: FastForward.NET Tags:

FastForward.NET: Projects

A Quick Recap

This is the third in a series of posts on how the new FastForward.NET monitor works. In my previous posts I covered the following items:

In this post I will look at how a user can interact with a CruiseControl.NET server.

Currently there are four ways a user can interact with the server:

  • Force a build
  • Abort a build
  • Start a project
  • Stop a project

I have removed the “volunteer to fix build” functionality for the moment, as I think it needs a bit more design to how to get it working properly!

Project Commands

Carrying on the standard for FastForward.NET monitor, there are four ways to execute any of the above commands. The first two approaches are fairly obvious:

Toolbar

There is the new toolbar – this has the four buttons on it. These buttons will always be displayed, no matter what tab is being displayed or which projects are selected.

The next, is the dropdown menu:

Menus

In CCTray the menus were very limited (and other than the settings menu, not very useful). In the FastForward.NET monitor all of the commands are also available in the menu system. Again, like the toolbar, these commands will always be visible.

When a command is selected from either the toolbar or the menu, the monitor will check to see which projects have been selected, and then send the commands to those projects. If there are no projects selected, then an error will be displayed:

NoProjectsError

The final two ways of triggering a command are both contextual. These are accessed by either right-clicking on the monitor explorer:

ExplorerMenu

On on the projects grid:

GridMenu

Both of these content menus are context-sensitive. Depending on the different project states, different menu options will be displayed. This only applies to the four project commands – the other commands are always displayed.

There is one other “major” change to CCTray – multiple projects can be selected! In the above screen shot there are three projects selected. When multiple projects are selected, the same command will be sent to all of them.

Build Parameters

The FastForward.NET monitor also allows build parameters. Since multiple projects can be selected, this interface is slightly different:

Parameters-1

In this screen shot we have the parameters for each of the projects listed. If cancel is clicked, then all of the build requests will be cancelled – it is an all or nothing approach.

In CC.NET each parameter can have a description associated with it. This is displayed in two different ways:

Parameters-2

The display panel down the bottom shows the description of the currently selected item. Additionally, mousing over any other item that has a description will display the description in a popup.

Finally, the parameters display obeys all the validation rules that have been set for the parameters:

Parameters-3

Clicking on ok will send the build commands to the server (or servers), along with the correct parameters. It won’t send the wrong parameters to the wrong project!

In Conclusion

Looking back, sending commands for projects hasn’t changed that much between CCTray and FastForward.NET, mainly making the commands more consistent and accessible, plus a couple of usability tweaks.

However, this does lay the groundwork for new functionality in the future :-)

Categories: FastForward.NET Tags:

FastForward.NET: Beta 1 Released!

9 August, 2009 2 comments

I have just published the first beta for the FastForward.NET Monitor application.

I’ve labelled this release a beta as it contains all the basic functionality I was planning on adding.  So, unless anyone comes up with a pressing reason for adding new functionality, what you see now is what will be in the actual release. Of course, I will still fix any bugs, and I know there is a bit more polishing to do.

You can download the latest installer from https://www.ohloh.net/p/FastForwardNET/download. Or if you’re daring you can get the latest source from SourceForge (this will have any additional bug fixes, etc.)

Let me know if you find any issues, happy testing…

:-)

Categories: FastForward.NET Tags:
Follow

Get every new post delivered to your Inbox.