Пример #1
0
        public IActionResult GetJobs(string jenkinsUrl)
        {
            // "http://jenkins-dbforge.datasoft.local:8080/job/Oracle4.0/"
            JenkinsConfig config = new JenkinsConfig()
            {
                JenkinsUrl = jenkinsUrl
            };

            JenkinsClient     client = new JenkinsClient(config);
            CancellationToken token  = new CancellationToken();
            var master = client.GetMaster(token).Result;

            var result = new List <JenkinsJob>();

            foreach (var job in master.Jobs)
            {
                result.Add(new JenkinsJob()
                {
                    Name  = job.Name,
                    Color = job.Color,
                    Url   = job.Url.ToString()
                });
            }

            Console.WriteLine($"{DateTime.Now.TimeOfDay.ToString()}: get-jobs for {jenkinsUrl} = {result.Count}");
            return(Json(result));
        }
Пример #2
0
        public IActionResult GetMaster(string jenkinsUrl)
        {
            JenkinsConfig config = new JenkinsConfig()
            {
                JenkinsUrl = jenkinsUrl
            };

            JenkinsClient     client = new JenkinsClient(config);
            CancellationToken token  = new CancellationToken();
            var master = client.GetMaster(token).Result;

            JenkinsMaster result = new JenkinsMaster()
            {
                Name = master.Name
            };

            return(Json(result));
        }