如何使用远程API获取CCNet构建的最终构建状态 [英] How to get the final build status for a CCNet build using the Remote API

查看:70
本文介绍了如何使用远程API获取CCNet构建的最终构建状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试编写一个简单的Java库来模拟来自GitHub的远程程序集。为此,我研究了.Net版本中的XML,并在Java中进行了仿真。我遇到了强制构建问题,并且想在出现问题时轮询服务器以获取构建结果。起初我以为这是我的Java代码(通常是可疑的),但是后来我发现.Net库似乎也存在相同的问题。

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.

我的C#测试代码如下:

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);
}

调试时,可以看到对<$ c $的调用c> GetMostRecentBuildNames 返回类似 log20151229103101Lbuild.47.xml的内容。看起来像Web前端的URL中使用的名称
。但是调用 GetFinalBuildStatus 会返回 null ,并查看响应XML,我可以看到响应
包含

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.

我错过了一些重要的东西,还是API的这一部分被破坏了?

Am I missing something crucial, or is this part of the API simply broken?

交叉发布到 http://www.cruisecontrolnet .org / boards / 2 / topics / 632

推荐答案

我最终还是使用了推送基于方法,在此方法中,我向工作添加了一组条件发布者。然后根据结果,发布者使用自定义Nant任务调用另一台计算机的REST接口并显示结果。

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.

这篇关于如何使用远程API获取CCNet构建的最终构建状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆