public Task <dynamic> Build(string buildId)
        {
            var cached = m_Cache.Get(buildId);

            if (cached == null)
            {
                m_Cache.Set(buildId, m_Underlying.Build(buildId));
            }
            return(m_Cache.Get(buildId));
        }
Esempio n. 2
0
        public async Task <TeamcityRevisionForBuild> RevisionForBuild(string buildId)
        {
            if (m_Cache.Get(buildId) != null)
            {
                return(m_Cache.Get(buildId));
            }

            var build = await m_Api.Build(buildId);

            var repo = GetRepo(build);
            var user = GetUser(build);

            if (build.revisions.revision != null)
            {
                foreach (var revision in build.revisions.revision)
                {
                    if (revision["vcs-root-instance"]["vcs-root-id"] == "SqlCompareDataCompareStaging_GitHubAutocrlfParameterised")
                    {
                        var result = new TeamcityRevisionForBuild(buildId, user, repo, revision.version);
                        m_Cache.Set(buildId, result);
                        return(result);
                    }
                }
            }
            if (build["snapshot-dependencies"] != null && build["snapshot-dependencies"].build != null)
            {
                foreach (var dependency in build["snapshot-dependencies"].build)
                {
                    var revisionFromDependency = await RevisionForBuild(dependency.id.ToString());

                    if (revisionFromDependency != null)
                    {
                        return(revisionFromDependency);
                    }
                }
            }
            return(null);
        }