Ejemplo n.º 1
0
        /// <summary>
        /// Parse out the identified known causes.  This needs to be kept up to date with the following:
        ///     http://dotnet-ci.cloudapp.net/failure-cause-management/
        /// </summary>
        public static bool TryGetBuildFailureInfo(JObject jobData, out BuildFailureInfo buildFailureInfo)
        {
            var actions = (JArray)jobData["actions"];
            var causeList = new List<BuildFailureCause>();
            if (TryGetFailureCauses(actions, causeList) ||
                TryGetUnitTestCauses(actions, causeList) ||
                TryGetMergeConflict(actions, causeList))
            {
                buildFailureInfo = new BuildFailureInfo(new ReadOnlyCollection<BuildFailureCause>(causeList));
                return true;
            }

            buildFailureInfo = null;
            return false;
        }
Ejemplo n.º 2
0
        private static BuildFailureCause GetBestCause(BuildFailureInfo info)
        {
            if (info == null)
            {
                return(BuildFailureCause.Unknown);
            }

            var cause = BuildFailureCause.Unknown;

            foreach (var current in info.CauseList)
            {
                if (cause.Category == BuildFailureCause.CategoryMergeConflict || cause.Category == BuildFailureCause.CategoryUnknown)
                {
                    cause = current;
                }
            }

            return(cause);
        }