CCNet API, docs?
I want to query my CCNet server to find out the status of the builds. I've heard rumor that there's a (ReST?) API of sorts, but I can't seem to find any documentation for it.
Is there any documentation for it, or do I need to download the CCNet sou开发者_如何学编程rce code and start reading?
EDIT: I found the endpoint /XmlStatusReport.aspx
, which gives an XML overview of all projects. The same filename in any folder gives exactly the same response, though, so I'm afraid that might be the only API there is.
As an alternative to the XML you already mentioned yourself, you could use remoting as the CCTray app does. If you reference ThoughtWorks.CruiseControl.Remote.dll form the CruiseControl.NET\server folder you can instantiate CruiseServerRemotingClient and use it to retrieve information from the server.
The following snippet prints out the list of projects on the server and their build statuses:
CruiseServerRemotingClient client = new CruiseServerRemotingClient("tcp://ccnetserver:21234/CruiseManager.rem");
ProjectStatus[] statusList = client.GetProjectStatus();
foreach (ProjectStatus status in statusList)
{
Console.WriteLine("{0}: {1}", status.Name, status.BuildStatus);
}
You could also retrieve the log for the latest build in XML format as follows:
string buildName = client.GetLatestBuildName("Jasenje");
Console.WriteLine(client.GetLog("Jasenje", buildName));
I haven't managed to find any real documentation for the API but at least there are XML comments with brief descriptions of methods and parameters.
精彩评论