views:

42

answers:

2

I have CruiseControl.NET version 1.4.4.83, and I am wondering if there it provides a url where the only control is the lastest build # of a project, so that I can access that data using curl or something?

Something like http://buildserver/ccnet/server/VMSDEV2/project/MyProject/LatestBuild.aspx

All that it would have is:

0.0.0.31

Update:

Fixed the IPlugin issue with an attribute for the class:

[Exortech.NetReflector.ReflectorType("latestBuildNumberProjectPlugin")]
public class LatestBuildNumberProjectPlugin : ICruiseAction, IPlugin
{
    public static readonly string ACTION_NAME;
    private readonly IFarmService farmService;
    private readonly ILinkFactory linkFactory;

    static LatestBuildNumberProjectPlugin()
    {
        ACTION_NAME = "LatestBuildNumber";
    }

    public LatestBuildNumberProjectPlugin(IFarmService farmService, ILinkFactory linkFactory)
    {
        this.farmService = farmService;
        this.linkFactory = linkFactory;
    }

    public IResponse Execute(ICruiseRequest cruiseRequest)
    {
        IProjectSpecifier projectSpecifier = cruiseRequest.ProjectSpecifier;
        IBuildSpecifier[] mostRecentBuildSpecifiers = this.farmService.GetMostRecentBuildSpecifiers(projectSpecifier, 1);
        if (mostRecentBuildSpecifiers.Length == 1)
        {
            var build = mostRecentBuildSpecifiers[0].BuildName;
            var response = new HtmlFragmentResponse(build);
            return response;
        }

        return new HtmlFragmentResponse("There are no complete builds for this project");
    }

    public INamedAction[] NamedActions
    {
        get
        {
            return new INamedAction[] { new ImmutableNamedAction(ACTION_NAME, this) };
        }
    }

    public string LinkDescription
    {
        get { return "Latest Build Number"; }
    }
}

And I've named my assembly:

 ccnet.latestBuildNumberProjectPlugin.plugin.dll

And in the dashboard.config file, I've added the plugin ref:

    <projectPlugins>
        ...
        <latestBuildReportProjectPlugin />
        ...
    </projectPlugins>

But apparently, var build = mostRecentBuildSpecifiers[0].BuildName; is not what I am looking for.

+1  A: 

I believe it is possible to create packages to extend the CC.NET Dashboard (i.e. the website) and completely change the interface.

To help you get started, check the CC.NET documentation.

A few links that could be of help.
- Developing Web Dashboard Plugins
- Building Packages
- Configuring the Web Dashboard

HTH,

Dennis Roche
Let me know how you go, I am actually interested in doing something similar myself.
Dennis Roche
Thanks. If I do something, I'll post it here. Getting it working is a low priority though... that's why I was posting to SO hoping someone would point out that it is already built in to CC.NET and I just couldn't find it.
slolife
A: 

The link to the latest build is:

http://myserver.com/cc_net/server/local/project/myproject/ViewLatestBuildReport.aspx

it will expand in :

http://myserver.com/cc_net/server/local/project/myproject/build/log20100618165244Lbuild.45.xml/ViewBuildReport.aspx

Inside the html page, you have your build number.

TridenT
Thanks. My hope is to do it without parsing anything. Just grab the content and go. Seems like other CI environments provide some url to do this. And, the page that you mentioned, ViewLatestBuildReport.aspx does include the build number, but it is not contained within an element that has an ID or css class to make it easily parsable.
slolife