Ejemplo n.º 1
0
        private List <ArtifactLinkRecord> GetWorkItemRangeArtifactLinks(List <int> workItemIds /*, string workitemSource*/, string targetTeamProject, string targetRepoName)
        {
            List <ArtifactLinkRecord> records = new List <ArtifactLinkRecord>();

            foreach (var item in workItemTrackingHttpClient.GetWorkItemsAsync(workItemIds, expand: WorkItemExpand.Relations).Result)
            {
                var artifactWorkItemLinks = item.Relations.Where(element => element.Rel == "ArtifactLink");

                foreach (var artifactLink in artifactWorkItemLinks)
                {
                    GitArtifactLinkDetails details = new GitArtifactLinkDetails(artifactLink, item.Relations.IndexOf(artifactLink));
                    if (details.IsGitLink)
                    {
                        ArtifactLinkRecord record = ValidateArtifactLink(item, details, targetTeamProject, targetRepoName);
                        records.Add(record);
                    }
                }
                Console.WriteLine($"Analyzing workItemID={item.Id}");
            }

            return(records);
        }
Ejemplo n.º 2
0
        private ArtifactLinkRecord ValidatePullRequestLink(WorkItem item, string targetTeamProject, string targetRepoName, GitArtifactLinkDetails linkDetails)
        {
            ProjectStatus projStatus = CheckProjecStatus(targetTeamProject, targetRepoName, linkDetails);

            ArtifactLinkRecord record = new ArtifactLinkRecord
            {
                WorkItemID                 = item.Id,
                WorkItemUrl                = item.Url,
                ArtifactUri                = linkDetails.Url,
                PullRequestID              = linkDetails.PullRequestID,
                IsDeletedRepo              = projStatus.IsDeletedRepo,
                isDestroyedRepo            = projStatus.IsDestroyedRepo,
                isTargetingExpectedProject = projStatus.IsTargetingExpectedProject,
                isTargetingExpectedRepo    = projStatus.IsTargetingExpectedRepo,
                LinkedProjectName          = projStatus.ProjectName,
                LinkedRepoId               = linkDetails.RepositoryID,
                LinkedRepoName             = projStatus.RepoName,
                Rev = item.Rev.Value,
                ArtifactLinkIndex = linkDetails.Index
            };

            return(record);
        }