是否有巡航控制.NET的API? [英] Is there an API for Cruise Control .NET?
问题描述
有没有我可以巡航控制.NET(CCNET)用于查询服务器,例如获得各种构建状态的API?
Is there an API I can use with Cruise Control .NET (ccnet) to query the server, for example to get the status of various builds?
我注意到,有在CCNET托盘应用程序几个选项连接,但我无法找到该服务API或如何使用它的例子中的任何文件。
I have noticed that there are a few options in the ccnet tray application for connecting but I cannot find any documentation of the service API or examples of how to consume it.
推荐答案
有肯定的API作为托盘应用程序使用它。我从他们的SVN仓库previously下载code(注:按下面的网址,它现在托管 github.com
)来修复一个bug(最后的建造时间栏目的工作方式 - 这是固定的,但是在1.5版本倒退),这可能会是一个很好的起点。
There's certainly an API as the Tray application uses it. I've downloaded the code from their SVN repository previously (NOTE: as per the URL below, it's now hosted on github.com
) to fix a bug (the way the "Last Build Time" column works - which was fixed, but regressed in the 1.5 release), and that'd probably be a good place to start.
库的URL是 https://github.com/ccnet/CruiseControl.NET
。
我刚刚更新了我的本地副本,并必须通过和你想要的是在远程的
项目。 CruiseServerHttpClient
类揩油一个可能的候选人
I've just updated my local copy and had a mooch through and a likely candidate for what you want is the CruiseServerHttpClient
class in the Remote
project.
使用远程
组装获得每个项目的状态/强制构建
Using the Remote
assembly to obtain the status of each project / force a build
- 从混帐编译源
- 创建一个新的控制台应用程序
- 添加引用
Thoughtworks.CruiseControl.Remote
和NetReflector
(都将在\\ bin目录在远程
项目) - 以下code添加到您的控制台应用程序
- Compile the source from git
- Create a new console application
- Add a reference to
Thoughtworks.CruiseControl.Remote
andNetReflector
(both will be in the \bin directory for theRemote
project) - Add the following code to your console application
控制台应用程序code:
Console application code:
using System;
using ThoughtWorks.CruiseControl.Core;
using ThoughtWorks.CruiseControl.Remote;
using ThoughtWorks.CruiseControl.Remote.Messages;
namespace CruiseControlInterface
{
class Program
{
static void Main(string[] args)
{
var ipAddressOrHostNameOfCCServer = ""; // Complete this value
var client = new CruiseServerHttpClient(
string.Format("http://{0}/ccnet/",ipAddressOrHostNameOfCCServer));
foreach (var projectStatus in client.GetProjectStatus())
{
Console.WriteLine("{0} - {1}", projectStatus.Name, projectStatus.BuildStatus);
}
}
}
}
对于每一个项目,你会得到类似的输出:
For each project you'll get output similar to:
项目名 - 成功
要强制建立,你让下面的调用:
To force a build, you'd make the following call:
client.Request("PROJECT_NAME", new IntegrationRequest(BuildCondition.ForceBuild, "YOUR_MACHINE_NAME", "YOUR_USER_NAME"));
根据这个结果在一个HTTP请求而作出的引擎盖包括:
Under the hood this results in a HTTP request being made that consists of:
POST <一个href=\"http://CC_SERVER_NAME/ccnet/ViewFarmReport.aspx\">http://CC_SERVER_NAME/ccnet/ViewFarmReport.aspx HTTP / 1.1结果
内容类型:应用程序/ x-WWW的形式urlen codeD结果
主持人:192.168.100.180结果
内容长度:64结果
期望:100-继续搜索
POST http://CC_SERVER_NAME/ccnet/ViewFarmReport.aspx HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Host: 192.168.100.180
Content-Length: 64
Expect: 100-continue
ForceBuild =真放; PROJECTNAME = PROJECT_NAME和放大器;服务器=本地搜索
ForceBuild=true&projectName=PROJECT_NAME&serverName=local
这篇关于是否有巡航控制.NET的API?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!