Retrieve VSTS/TFS Build task name list

限于喜欢 提交于 2019-12-11 17:46:08

问题


I need to retrieve build task name list from VSTS/TFS build. Is there inbuilt method/library available to support this?

I have already noted (as below sample) that we can retrieve same in release.

import ReleaseClient = require("ReleaseManagement/Core/RestClient");
var rc= ReleaseClient.getClient(); 

release.environments.forEach(function (env) { 
    rc.getTasks(VSS.getWebContext().project.id, release.id, env.id).then(function(taskList){
    ...............
    ......Some code here
    });
}

回答1:


The documentation doesn't show a direct function call to retrieve the tasks. However, there is a contract for a BuildDefinition, which contains a build property, which is an array of BuildDefinitionStep, each of which has a task property that contains things like the name of the task and the inputs.

The getDefinition() function should give you back a build definition you can work with.

import RestClient = require("TFS/Build/RestClient");

// Get an instance of the client
var client = RestClient.getClient();
var myDefinition client.getDefinition(1234);


来源:https://stackoverflow.com/questions/45218224/retrieve-vsts-tfs-build-task-name-list

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!