示例#1
0
 static async Task MainAsync(Credentials credential, GoUrls urls, Configuration configuration)
 {
     var timing = new Timing(credential,  urls, configuration.JobCount);
     var jobHeirarchies = await timing.GetPipelineDetailsAsync();
     foreach (var jobHeirarchy in jobHeirarchies)
     {
         var jobs = await timing.GetJobsAsync(jobHeirarchy.PipelineName, jobHeirarchy.StageName);
         foreach (var job in jobs)
         {
             var jobDetails = await timing.GetJobDetailsAsync(jobHeirarchy.PipelineName, jobHeirarchy.StageName, job.name);
             jobDetails.ForEach(jd => PrintingExtensions.PrintJobDetails(jd, jobHeirarchy.PipelineName, jobHeirarchy.StageName, job.name, configuration.MaxWaitTimeout));
         }
     }
 }
示例#2
0
        static void Main()
        {
            try
            {
                var baseUrl = ConfigurationManager.AppSettings.Get(@"baseUrl");
                if (string.IsNullOrEmpty(baseUrl))
                {
                    throw new ConfigurationException(nameof(baseUrl), "BaseUrl of Go was not specified in App.config");
                }
                var urls = new GoUrls(baseUrl);

                var authCred = ConfigurationManager.AppSettings.Get(@"authCred");
                if (string.IsNullOrEmpty(authCred))
                {
                    throw new ConfigurationException(nameof(authCred), "Go Credentials no specified, should be of the form user:password");
                }

                var jobCount = int.Parse(ConfigurationManager.AppSettings.Get(@"jobCount"));
                var maxWaitTime = int.Parse(ConfigurationManager.AppSettings.Get(@"maxWaitTime"));
                var configuration = new Configuration(jobCount, maxWaitTime);

                var credential = new Credentials(authCred);
                MainAsync(credential, urls, configuration).Wait();
            }
            catch (ConfigurationException argumentNullException)
            {
                WriteToConsoleWithColor(argumentNullException.ToString(), ConsoleColor.Red);
            }
            catch(FormatException)
            {
                WriteToConsoleWithColor("Error Parsing jobCount or maxWaitTime", ConsoleColor.Red);
            }
            catch (Exception exception)
            {
                WriteToConsoleWithColor("Error : " + exception.Message, ConsoleColor.Red);
                if(exception.InnerException != null && exception.InnerException.Message != null)
                {
                    WriteToConsoleWithColor("Error : " + exception.InnerException.Message, ConsoleColor.Red);
                }
                WriteToConsoleWithColor("There was likely an error in connecting to Go", ConsoleColor.Red);
            }
            ReadKey();
        }
示例#3
0
 public GoApi(Credentials credentials, GoUrls urls)
 {
     _credentials = credentials;
     _httpWrapper = new HttpWrapper(credentials);
     this.Urls    = urls;
 }
示例#4
0
 public Timing(Credentials credentials, GoUrls urls, int jobLimitCount) : base(credentials, urls)
 {
     this.jobLimitCount = jobLimitCount;
 }
示例#5
0
 public GoApi(Credentials credentials, GoUrls urls)
 {
     _credentials = credentials;
     _httpWrapper = new HttpWrapper(credentials);
     this.Urls = urls;
 }