• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript BuildApi.IBuildApi类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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(``);
//.........这里部分代码省略.........
开发者ID:Edgixshua,项目名称:vNextBuild,代码行数:101,代码来源:GenerateReleaseNotes.ts


示例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 */
 }
开发者ID:Microsoft,项目名称:vsts-vscode,代码行数:7,代码来源:build.ts


示例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 */
 }
开发者ID:Microsoft,项目名称:vsts-vscode,代码行数:7,代码来源:build.ts


示例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);
 }
开发者ID:Microsoft,项目名称:vsts-vscode,代码行数:4,代码来源:build.ts


示例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);
 };
开发者ID:Microsoft,项目名称:vsts-vscode,代码行数:4,代码来源:build.ts


示例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);
 }
开发者ID:Microsoft,项目名称:vsts-vscode,代码行数:4,代码来源:build.ts



注:本文中的vso-node-api/BuildApi.IBuildApi类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript HttpClient.HttpCallbackClient类代码示例发布时间:2022-05-25
下一篇:
TypeScript testrunner.configure函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap