本文整理汇总了TypeScript中vso-node-api/BuildApi.IBuildApi.getWorkItemsBetweenBuilds方法的典型用法代码示例。如果您正苦于以下问题:TypeScript IBuildApi.getWorkItemsBetweenBuilds方法的具体用法?TypeScript IBuildApi.getWorkItemsBetweenBuilds怎么用?TypeScript IBuildApi.getWorkItemsBetweenBuilds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vso-node-api/BuildApi.IBuildApi
的用法示例。
在下文中一共展示了IBuildApi.getWorkItemsBetweenBuilds方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: parseInt
var promise = new Promise<void>(async (resolve, reject) => {
try {
agentApi.logDebug("Starting Tag XplatGenerateReleaseNotes task");
let tpcUri = tl.getVariable("System.TeamFoundationCollectionUri");
let teamProject = tl.getVariable("System.TeamProject");
let releaseId: number = parseInt(tl.getVariable("Release.ReleaseId"));
let releaseDefinitionId: number = parseInt(tl.getVariable("Release.DefinitionId"));
// Inputs
let environmentName: string = (tl.getInput("overrideStageName") || tl.getVariable("Release_EnvironmentName")).toLowerCase();
var templateLocation = tl.getInput("templateLocation", true);
var templateFile = tl.getInput("templatefile");
var inlineTemplate = tl.getInput("inlinetemplate");
var outputfile = tl.getInput("outputfile", true);
var outputVariableName = tl.getInput("outputVariableName");
var emptyDataset = tl.getInput("emptySetText");
let credentialHandler: vstsInterfaces.IRequestHandler = util.getCredentialHandler();
let vsts = new webApi.WebApi(tpcUri, credentialHandler);
var releaseApi: IReleaseApi = await vsts.getReleaseApi();
var buildApi: IBuildApi = await vsts.getBuildApi();
agentApi.logInfo("Getting the current release details");
var currentRelease = await releaseApi.getRelease(teamProject, releaseId);
if (!currentRelease) {
reject(`Unable to locate the current release with id ${releaseId}`);
return;
}
var environmentId = util.getReleaseDefinitionId(currentRelease.environments, environmentName);
let mostRecentSuccessfulDeployment = await util.getMostRecentSuccessfulDeployment(releaseApi, teamProject, releaseDefinitionId, environmentId);
let mostRecentSuccessfulDeploymentRelease: Release;
agentApi.logInfo(`Getting all artifacts in the current release...`);
var arifactsInThisRelease = util.getSimpleArtifactArray(currentRelease.artifacts);
agentApi.logInfo(`Found ${arifactsInThisRelease.length}`);
let arifactsInMostRecentRelease: util.SimpleArtifact[] = [];
var mostRecentSuccessfulDeploymentName: string = "";
if (mostRecentSuccessfulDeployment) {
// Get the release that the deployment was a part of - This is required for the templating.
mostRecentSuccessfulDeploymentRelease = await releaseApi.getRelease(teamProject, mostRecentSuccessfulDeployment.release.id);
agentApi.logInfo(`Getting all artifacts in the most recent successful release [${mostRecentSuccessfulDeployment.release.name}]...`);
arifactsInMostRecentRelease = util.getSimpleArtifactArray(mostRecentSuccessfulDeployment.release.artifacts);
mostRecentSuccessfulDeploymentName = mostRecentSuccessfulDeployment.release.name;
agentApi.logInfo(`Found ${arifactsInMostRecentRelease.length}`);
} else {
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(``);
//.........这里部分代码省略.........