Exemple #1
0
        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");
        }
Exemple #4
0
        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);
            }
        }