问题
I've been trying to write a simple Java library to emulate the Remote assembly from GitHub. To do this, I looked at the XML going over the wire from the .Net version, and emulated that in Java. I got "force build" working and wanted to poll the server for the results of the build when I ran into problems. At first I thought it was my Java code (the usual suspect), but then I could see that the same problem seemed to exist with the .Net library.
My C# test code looks like this:
public void GetStatus() {
CruiseServerClient client = new CruiseServerClientFactory().GenerateClient("http://myserver/ccnet", "local") as CruiseServerClient;
String projectName = "MyProject";
String buildName = client.GetMostRecentBuildNames(projectName, 1)[0];
ProjectStatusSnapshot status = client.GetFinalBuildStatus(projectName, buildName);
Console.WriteLine(status.Status);
}
When I debug it, I can see that the call to GetMostRecentBuildNames
returns something like "log20151229103101Lbuild.47.xml". This looks like the name
used in the URL's for the Web front-end. However calling GetFinalBuildStatus
returns null
, and looking at the response XML, I can see that the response
contains a warning saying that the build name does not exist.
Am I missing something crucial, or is this part of the API simply broken?
Cross-posted to http://www.cruisecontrolnet.org/boards/2/topics/632
回答1:
I eventually ended up using a push based approach, where i added a set of conditional publishers to the job. Depending on the result, the publisher then uses a custom Nant task to call the another machine's REST interface with the results.
The final solution feels cleaner than polling for results, so I'm happy with it.
来源:https://stackoverflow.com/questions/34510108/how-to-get-the-final-build-status-for-a-ccnet-build-using-the-remote-api