Exemple #1
0
        private void JenkinsWindowLoaded(object sender, System.Windows.RoutedEventArgs e)
        {
            jenkinsClient = new JenkinsClient
            {
                BaseUrl  = $"http://{Host}:{Port}/",
                UserName = User,
                ApiToken = ApiKey,
            };
            var jenkins = jenkinsClient.Get();

            List <Job> jobList = new List <Job>();

            foreach (var job in jenkins.Jobs)
            {
                jobList.Add(new Job {
                    Name = job.Name
                });
            }

            foreach (var job in jenkins.Jobs)
            {
                fields = new List <JobProperty>();
                JenkinsJobBase jenkinsJob = jenkinsClient.Jobs.Get <JenkinsJobBase>(job.Name) as JenkinsJobBase;
                foreach (var action in jenkinsJob.Actions)
                {
                    FindAllNodes(action.Node);
                }
                jobData[job.Name] = fields;
            }


            Jobs = new ObservableCollection <Job>(jobList);
            JobCombo.SelectedItem = Jobs[0];
        }
Exemple #2
0
        private static void SetupDeleteJob(JenkinsClient client)
        {
            var jenkins = client.Get();

            if (jenkins.Jobs.Any(x => string.Equals(x.Name, "Delete Job", System.StringComparison.OrdinalIgnoreCase)))
            {
                return;
            }

            var createJob = client.Jobs.GetConfiguration("Test Job");

            var deleteJob = new JenkinsProject(createJob.Node);

            client.Jobs.Create("Delete Job", deleteJob);
        }