本文整理汇总了TypeScript中vso-node-api/WebApi.WebApi.getWorkItemTrackingApi方法的典型用法代码示例。如果您正苦于以下问题:TypeScript WebApi.getWorkItemTrackingApi方法的具体用法?TypeScript WebApi.getWorkItemTrackingApi怎么用?TypeScript WebApi.getWorkItemTrackingApi使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vso-node-api/WebApi.WebApi
的用法示例。
在下文中一共展示了WebApi.getWorkItemTrackingApi方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: parseInt
//.........这里部分代码省略.........
agentApi.logInfo(`Skipping fetching artifact in the most recent successful release as there isn't one.`);
// we need to set the last successful as the current release to templates can get some data
mostRecentSuccessfulDeploymentRelease = currentRelease;
}
var globalCommits: Change[] = [];
var globalWorkItems: ResourceRef[] = [];
for (var artifactInThisRelease of arifactsInThisRelease) {
agentApi.logInfo(`Looking at artifact [${artifactInThisRelease.artifactAlias}]`);
agentApi.logInfo(`Build Number: [${artifactInThisRelease.buildNumber}]`);
var buildNumberFromMostRecentBuild = null;
if (arifactsInMostRecentRelease.length > 0) {
agentApi.logInfo(`Looking for the [${artifactInThisRelease.artifactAlias}] in the most recent successful release [${mostRecentSuccessfulDeploymentName}]`);
for (var artifactInMostRecentRelease of arifactsInMostRecentRelease) {
if (artifactInThisRelease.artifactAlias.toLowerCase() === artifactInMostRecentRelease.artifactAlias.toLowerCase()) {
agentApi.logInfo(`Found artifact [${artifactInThisRelease.artifactAlias}] with build number [${artifactInThisRelease.buildNumber}] in release [${mostRecentSuccessfulDeploymentName}]`);
// Only get the commits and workitems if the builds are different
if (artifactInMostRecentRelease.buildNumber.toLowerCase() !== artifactInThisRelease.buildNumber.toLowerCase()) {
agentApi.logInfo(`Checking what commits and workitems have changed from [${artifactInMostRecentRelease.buildNumber}] => [${artifactInThisRelease.buildNumber}]`);
var commits = await buildApi.getChangesBetweenBuilds(teamProject, parseInt(artifactInMostRecentRelease.buildId), parseInt(artifactInThisRelease.buildId), 5000);
var workitems = await buildApi.getWorkItemsBetweenBuilds(teamProject, parseInt(artifactInMostRecentRelease.buildId), parseInt(artifactInThisRelease.buildId), 5000);
var commitCount: number = 0;
var workItemCount: number = 0;
if (commits) {
commitCount = commits.length;
globalCommits = globalCommits.concat(commits);
}
if (workitems) {
workItemCount = workitems.length;
globalWorkItems = globalWorkItems.concat(workitems);
}
agentApi.logInfo(`Detected ${commitCount} commits/changesets and ${workItemCount} workitems between the builds.`);
} else {
agentApi.logInfo(`Build for artifact [${artifactInThisRelease.artifactAlias}] has not changed. Nothing to do`);
}
}
}
}
agentApi.logInfo(``);
}
// remove duplicates
globalCommits = globalCommits.filter((thing, index, self) =>
index === self.findIndex((t) => (
t.id === thing.id
))
);
globalWorkItems = globalWorkItems.filter((thing, index, self) =>
index === self.findIndex((t) => (
t.id === thing.id
))
);
let expandedGlobalCommits = await util.expandTruncatedCommitMessages(vsts.rest, globalCommits);
if (!expandedGlobalCommits || expandedGlobalCommits.length !== globalCommits.length) {
reject("Failed to expand the global commits.");
return;
}
// get an array of workitem ids
var workItemIds = globalWorkItems.map(wi => parseInt(wi.id));
var workItemTrackingApi: IWorkItemTrackingApi = await vsts.getWorkItemTrackingApi();
let fullWorkItems: void | WorkItem[];
if (workItemIds.length > 0) {
fullWorkItems = await workItemTrackingApi.getWorkItems(workItemIds, null, null, WorkItemExpand.Fields, null);
}
if (!fullWorkItems) {
fullWorkItems = [];
}
agentApi.logInfo(`Total commits: [${globalCommits.length}]`);
agentApi.logInfo(`Total workitems: [${globalWorkItems.length}]`);
var template = util.getTemplate (templateLocation, templateFile, inlineTemplate);
var outputString = util.processTemplate(template, fullWorkItems, globalCommits, currentRelease, mostRecentSuccessfulDeploymentRelease, emptyDataset);
util.writeFile(outputfile, outputString);
agentApi.writeVariable(outputVariableName, outputString.toString());
resolve();
} catch (err) {
agentApi.logError(err);
reject(err);
}
});