powershell - 使用 PowerShell 创建 CCNet 服务器上所有项目的列表

标签 powershell cruisecontrol.net

我的任务是使用 CruiseControl.NET 审核构建服务器。其中有很多,我想知道是否有一种方法可以以编程方式/自动编译每个项目的项目列表。

有办法吗?

我的第一直觉是使用 PowerShell (v2.0),但我不确定如何开始编写满足我要求的脚本。我应该使用 PowerShell 还是其他方法?那些其他方法是什么?

最佳答案

我会使用 Thoughtworks.CruiseControl.Remote.dll 并将其加载到 powershell

创建ICruiseManagerFactory managerFactory;

然后您可以遍历您拥有的服务器列表并为服务器创建 Uri,例如:

 ServerUri = @"tcp://" + Server + ":" + Port + @"/CruiseManager.rem"

然后使用以下命令从该服务器获取项目列表和状态:

 ProjectStatus[] currentStatuses = managerFactory.GetCruiseManager(ServerUri).GetProjectStatus();

然后遍历列表:

        foreach (ProjectStatus projectStatus in currentStatuses)
        {
            string name = projectStatus.Name;
            string status = projectStatus.Status;
  }

关于powershell - 使用 PowerShell 创建 CCNet 服务器上所有项目的列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4153406/

相关文章:

cruisecontrol.net - 即使使用 <successExitCodes>,使用 RoboCopy 的 CCNET Exec 也会失败

windows - 让 CruiseControl 使用正确的公钥与 github 对话

powershell - 二级包容

windows - 获取设备的连接端口号和集线器号

cruisecontrol.net - 在 CruiseControl.Net 中,如何将 checkin 代码的开发人员用户名传递给另一个项目?

svn - Cruise Control.Net 最佳实践

powershell - Get-Unique 返回不正确的结果

windows - 如何在 Windows 2012 Server 任务计划程序中提取所有计划作业的列表?

powershell - 在 PowerShell 中多次重复部分命令

svn - 如何使用 CruiseControl.net 根据 Subversion 修订号设置内部版本号