Пример #1
0
        private static void PopulateAllJobInfos(DataClient dataClient)
        {
            var roslynClient = new RoslynClient();
            var client = roslynClient.Client;
            foreach (var name in roslynClient.GetJobNames())
            {
                List<JobId> jobs;
                try
                {
                    jobs = client.GetJobIds(name);
                }
                catch
                {
                    Console.WriteLine($"Can't get jobs for {name}");
                    continue;
                }

                foreach (var id in jobs)
                {
                    try
                    {
                        Console.Write($"Processing {id.Id} {id.Name} ... ");
                        var info = client.GetJobInfo(id);
                        dataClient.InsertJobInfo(info);
                        Console.WriteLine("Done");
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine("ERROR!!!");
                        Console.WriteLine(ex.Message);
                    }
                }
            }
        }
Пример #2
0
        private static RoslynClient CreateClient()
        {
            var client = new RoslynClient();
            try
            {
                var text = File.ReadAllText(@"c:\users\jaredpar\jenkins.txt");
                if (string.IsNullOrEmpty(text))
                {
                    return client;
                }

                var uriBuilder = new UriBuilder(client.Client.RestClient.BaseUrl);
                var values = text.Split(':');
                uriBuilder.UserName = values[0];
                uriBuilder.Password = values[1];
                client.Client.RestClient.BaseUrl = uriBuilder.Uri;
                return client;
            }
            catch
            {
                return client;
            }
        }