BuildAttribute(string buildName, string attributeName)
        {
            return(infos =>
            {
                var match = OrchestratedBuildIdentityMatch.Find(buildName, infos);

                string value;
                if (match.Match.Attributes.TryGetValue(attributeName, out value))
                {
                    return new DependencyReplacement(value, new[] { match.Info });
                }

                return null;
            });
        }
        protected override string GetDesiredCommitHash(
            IEnumerable <IDependencyInfo> dependencyInfos,
            out IEnumerable <IDependencyInfo> usedDependencyInfos)
        {
            OrchestratedBuildIdentityMatch match = OrchestratedBuildIdentityMatch.Find(
                BuildName,
                dependencyInfos);

            if (match == null)
            {
                usedDependencyInfos = null;
                return(null);
            }

            match.EnsureMatchHasCommit();

            usedDependencyInfos = new[] { match.Info };
            return(match.Match.Commit);
        }
        BuildAttribute(string buildName, string attributeName)
        {
            return(infos =>
            {
                var match = OrchestratedBuildIdentityMatch.Find(buildName, infos);

                if (match == null)
                {
                    Trace.TraceInformation($"No build identity match for '{buildName}'.");
                    return null;
                }

                string value;
                if (match.Match.Attributes.TryGetValue(attributeName, out value))
                {
                    return new DependencyReplacement(value, new[] { match.Info });
                }

                Trace.TraceInformation(
                    $"In build identity '{buildName}', no attribute '{attributeName}'.");
                return null;
            });
        }