本文整理汇总了TypeScript中vso-node-api/BuildApi.IBuildApi类的典型用法代码示例。如果您正苦于以下问题:TypeScript IBuildApi类的具体用法?TypeScript IBuildApi怎么用?TypeScript IBuildApi使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IBuildApi类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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(``);
//.........这里部分代码省略.........
示例2: GetBuildsByDefinitionId
//Returns the "latest" build for this definition
public async GetBuildsByDefinitionId(teamProject: string, definitionId: number): Promise<Build[]> {
/* tslint:disable:no-null-keyword */
return await this._buildApi.getBuilds(teamProject, [ definitionId ], null, null, null, null, null, null, null, null, null, null,
1, null, 1, QueryDeletedOption.ExcludeDeleted, BuildQueryOrder.FinishTimeDescending);
/* tslint:enable:no-null-keyword */
}
示例3: GetBuilds
//Returns the most recent 100 completed builds
public async GetBuilds(teamProject: string): Promise<Build[]> {
/* tslint:disable:no-null-keyword */
return await this._buildApi.getBuilds(teamProject, null, null, null, null, null, null, null, BuildStatus.Completed, null, null, null,
100, null, 1, QueryDeletedOption.ExcludeDeleted, BuildQueryOrder.FinishTimeDescending);
/* tslint:enable:no-null-keyword */
}
示例4: GetBuildDefinitions
//Returns the build definitions (regardless of type) for the team project
public async GetBuildDefinitions(teamProject: string): Promise<DefinitionReference[]> {
return await this._buildApi.getDefinitions(teamProject);
}
示例5: GetBuildById
//Get extra details of a build based on the build id
public async GetBuildById(buildId: number): Promise<Build> {
return await this._buildApi.getBuild(buildId);
};
示例6: GetBuildBadge
//Get the latest build id and badge of a build definition based on current project, repo and branch
public async GetBuildBadge(project: string, repoType: string, repoId: string, branchName: string): Promise<BuildBadge> {
return await this._buildApi.getBuildBadge(project, repoType, repoId, branchName);
}