0

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

mhvelplund
  • 2,099
  • 3
  • 22
  • 38
  • As an aside, calling ``GetProjectStatus`` results in a HTTP 500 response from the server, due to a null pointer exception. – mhvelplund Dec 29 '15 at 11:37
  • ... but ``TakeStatusSnapshot``works and returns an object that can be used to monitor whatever is running or ran last. – mhvelplund Dec 29 '15 at 13:20
  • What happens if you use the GetBuildStatus() or GetBuildStatuses() methods? – Simon Laing Dec 30 '15 at 08:56
  • And for completeness which version of the server are you using? – Simon Laing Dec 30 '15 at 08:56
  • As noted in http://stackoverflow.com/a/34509923/511976, I'm running 1.8.4 of the server, now with the same version of the Remote assembly client. After some experimentation my results are: If I don't have an ```` publisher, I get a proper error message saying I need that. Looking at the build names returned by CC I can see that the correspond to the xml log file names. Once I add the logger, the server throws a null reference exception leading to an HTTP 500 response. I can see that the log file with the name of the most recent build name is there. – mhvelplund Jan 05 '16 at 09:39
  • Have you tried the GetBuildStatus() or GetBuildStatuses() methods? Do they work or also return `null`? – Simon Laing Jan 07 '16 at 07:18
  • ``ThoughtWorks.CruiseControl.Remote.CruiseServerClient`` ver. 1.8.4.0 doesn't have those methods. I need to use a client that speaks XML/JSON across the wire, but maybe there's a better client class? – mhvelplund Jan 07 '16 at 13:26
  • FYI, I ended up using a custom Nant task in a publisher to call me when the build completes. – mhvelplund Jan 07 '16 at 13:27

1 Answers1

0

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.

mhvelplund
  • 2,099
  • 3
  • 22
  • 38