Ejemplo n.º 1
0
        public JenkinsBuild GetLatestBuild(JenkinsRef reference, JenkinsOptions options)
        {
            if (options == null)
            {
                options = new JenkinsOptions();
            }
            string url = Regex.Replace(reference.BaseUri.ToString(), @"/$", "");

            return(Call <JenkinsBuild>(
                       $"{url}/{BuildTypeToProperty[options.BuildType]}/api/json"
                       ));
        }
Ejemplo n.º 2
0
        public IEnumerable <JenkinsBuild> GetAllBuilds(JenkinsRef reference, JenkinsOptions options)
        {
            if (options == null)
            {
                options = new JenkinsOptions();
            }
            string  url       = Regex.Replace(reference.BaseUri.ToString(), @"/$", "");
            JObject job       = Call <JObject>($"{url}/api/json");
            JArray  builds    = (JArray)job["builds"];
            string  resultVal = null;

            BuildTypeToResult.TryGetValue(options.BuildType, out resultVal);
            foreach (JObject buildEntry in builds)
            {
                Log.Info($"Processing {buildEntry["url"]}");
                JenkinsBuild build = Call <JenkinsBuild>($"{buildEntry["url"]}api/json");
                // Make sure build status matches options.BuildType
                if (resultVal == null || build.Result == resultVal)
                {
                    yield return(build);
                }
            }
        }