public ActionResult MachineOverview() { MachineOverviewModel machineOverviewModel = new MachineOverviewModel(); machineOverviewModel.SetBuildServiceHostCollection(BuildServerHelper.GetAllBuildServiceHosts(configurationServer)); return(PartialView(machineOverviewModel)); }
public ActionResult MachineOverview(string id) { MachineOverviewModel machineOverviewModel = new MachineOverviewModel(); if (!string.IsNullOrWhiteSpace(id)) { TfsTeamProjectCollection tpc = configurationServer.GetTeamProjectCollection(new Guid(id)); machineOverviewModel.SetBuildServiceHostCollection(BuildServerHelper.GetAllBuildServiceHosts(tpc)); } return(PartialView(machineOverviewModel)); }
public void Execute() { logger.Info("Extract Build Machines in progress..."); ICollection <BuildServiceHostDefinition> buildServiceHostList = BuildServerHelper.GetAllBuildServiceHosts(configurationServer); ArrayList records = new ArrayList(); foreach (BuildServiceHostDefinition buildServiceHostDefinition in buildServiceHostList) { foreach (BuildControllerDefinition controller in buildServiceHostDefinition.BuildControllers) { records.Add( new { HostName = buildServiceHostDefinition.Name, IP = GetIPFromHostName(buildServiceHostDefinition.Name), CollectionName = buildServiceHostDefinition.CollectionName, ServiceType = "Controller", ServiceName = controller.Name, Status = controller.Status }); } foreach (BuildAgentDefinition agent in buildServiceHostDefinition.BuildAgents) { records.Add( new { HostName = buildServiceHostDefinition.Name, IP = GetIPFromHostName(buildServiceHostDefinition.Name), CollectionName = buildServiceHostDefinition.CollectionName, ServiceType = "Agent", ServiceName = agent.Name, Status = agent.Status }); } } string fileName = FileNameTool.GetFileName("TfsExtractMachineList"); using (CsvWriter csv = new CsvWriter((new StreamWriter(fileName)))) { csv.WriteExcelSeparator(); csv.WriteRecords(records); } logger.Info("Extract Build Machines done"); }
public void Execute(string[] args) { ICollection <BuildServiceHostDefinition> buildServiceHostList = BuildServerHelper.GetAllBuildServiceHosts(configurationServer); ArrayList records = new ArrayList(); foreach (BuildServiceHostDefinition buildServiceHostDefinition in buildServiceHostList) { foreach (BuildControllerDefinition controller in buildServiceHostDefinition.BuildControllers) { records.Add( new { HostName = buildServiceHostDefinition.Name, CollectionName = buildServiceHostDefinition.CollectionName, ServiceType = "Controller", ServiceName = controller.Name, Status = controller.Status }); } foreach (BuildAgentDefinition agent in buildServiceHostDefinition.BuildAgents) { records.Add( new { HostName = buildServiceHostDefinition.Name, CollectionName = buildServiceHostDefinition.CollectionName, ServiceType = "Agent", ServiceName = agent.Name, Status = agent.Status }); } } using (CsvWriter csv = new CsvWriter(new StreamWriter(Path.Combine(Environment.GetEnvironmentVariable("TfsExtractPath", EnvironmentVariableTarget.User), Environment.GetEnvironmentVariable("TfsExtractMachineList", EnvironmentVariableTarget.User))))) { csv.WriteRecords(records); } }
public ActionResult BuildOverview(string id) { if (string.IsNullOrEmpty(id)) { return(RedirectToAction("Index")); } BuildOverviewModel bom = new BuildOverviewModel(); if (!string.IsNullOrWhiteSpace(id)) { TfsTeamProjectCollection tpc = configurationServer.GetTeamProjectCollection(new Guid(id)); ReadOnlyCollection <CatalogNode> teamProjectNodes = tpc.CatalogNode.QueryChildren( new[] { CatalogResourceTypes.TeamProject }, false, CatalogQueryOptions.None); IBuildServer bs = tpc.GetService <IBuildServer>(); foreach (CatalogNode teamProjectNode in teamProjectNodes) { BuildServerHelper.FeedBuildDefinition(bom.BuildDefinitionCollection, bs, teamProjectNode.Resource.DisplayName); } } return(PartialView(bom)); }