Exemplo n.º 1
0
        private BuildResultClassification ConvertToClassification(BuildFailureCause cause)
        {
            if (cause.Category == BuildFailureCause.CategoryMergeConflict)
            {
                return(BuildResultClassification.MergeConflict);
            }

            if (cause.Category == BuildFailureCause.CategoryUnknown)
            {
                return(BuildResultClassification.Unknown);
            }

            var category = cause.Category.ToLower();

            switch (category)
            {
            case "test":
                return(BuildResultClassification.TestFailure);

            case "build":
                return(BuildResultClassification.BuildFailure);

            case "infrastructure":
                return(BuildResultClassification.Infrastructure);

            default:
                return(new BuildResultClassification(ClassificationKind.Custom, cause.Category, cause.Name));
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Look at the "foundFailureCauses" member of the JSON.  This is the custom failures that Jenkins
        /// admins have assigned via regex.  
        ///     http://dotnet-ci.cloudapp.net/failure-cause-management/
        /// </summary>
        private static bool TryGetFailureCauses(JArray actions, List<BuildFailureCause> causeList)
        {
            var any = false;
            foreach (var cur in actions)
            {
                var foundCauses = (JArray)cur["foundFailureCauses"];
                if (foundCauses == null)
                {
                    continue;
                }

                foreach (JObject entry in foundCauses)
                {
                    var category = GetCategory(entry);
                    if (category == null)
                    {
                        continue;
                    }

                    var description = entry.Value<string>("description");
                    var name = entry.Value<string>("name");
                    var cause = new BuildFailureCause(name: name, description: description, category: category);
                    causeList.Add(cause);
                    any = true;
                }
            }

            return any;
        }
Exemplo n.º 3
0
        private BuildResultClassification ConvertToClassification(BuildFailureCause cause)
        {
            if (cause.Category == BuildFailureCause.CategoryMergeConflict)
            {
                return BuildResultClassification.MergeConflict;
            }

            if (cause.Category == BuildFailureCause.CategoryUnknown)
            {
                return BuildResultClassification.Unknown;
            }

            var category = cause.Category.ToLower();
            switch (category)
            {
                case "test":
                    return BuildResultClassification.TestFailure;
                case "build":
                    return BuildResultClassification.BuildFailure;
                case "infrastructure":
                    return BuildResultClassification.Infrastructure;
                default:
                    return new BuildResultClassification(ClassificationKind.Custom, cause.Category, cause.Name);
            }
        }