Taskgroups - List
列出任务组。
GET https://dev.azure.com/{organization}/{project}/_apis/distributedtask/taskgroups/{taskGroupId}?api-version=7.1
GET https://dev.azure.com/{organization}/{project}/_apis/distributedtask/taskgroups/{taskGroupId}?expanded={expanded}&taskIdFilter={taskIdFilter}&deleted={deleted}&$top={$top}&continuationToken={continuationToken}&queryOrder={queryOrder}&api-version=7.1
URI 参数
名称 | 在 | 必需 | 类型 | 说明 |
---|---|---|---|---|
organization
|
path | True |
string |
Azure DevOps 组织的名称。 |
project
|
path | True |
string |
项目 ID 或项目名称 |
task
|
path |
string (uuid) |
任务组的 ID。 |
|
api-version
|
query | True |
string |
要使用的 API 版本。 这应设置为“7.1”才能使用此版本的 API。 |
$top
|
query |
integer (int32) |
要获取的任务组数。 |
|
continuation
|
query |
string (date-time) |
获取提供继续标记后的任务组。 |
|
deleted
|
query |
boolean |
“true”以包含已删除的任务组。 默认值为“false”。 |
|
expanded
|
query |
boolean |
以递归方式展开任务组的“true”。 默认值为“false”。 |
|
query
|
query |
按定义的顺序获取结果。 默认值为“CreatedOnDescending”。 |
||
task
|
query |
string (uuid) |
要筛选的 taskId 的 Guid。 |
响应
名称 | 类型 | 说明 |
---|---|---|
200 OK |
成功作 |
安全性
oauth2
类型:
oauth2
流向:
accessCode
授权 URL:
https://app.vssps.visualstudio.com/oauth2/authorize&response_type=Assertion
令牌 URL:
https://app.vssps.visualstudio.com/oauth2/token?client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer&grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer
作用域
名称 | 说明 |
---|---|
vso.taskgroups_read | 授予读取任务组的功能 |
示例
List all task groups |
List all versions of a task group |
List all task groups
示例请求
GET https://dev.azure.com/fabrikam/{project}/_apis/distributedtask/taskgroups?api-version=7.1
示例响应
{
"count": 3,
"value": [
{
"tasks": [
{
"displayName": "PowerShell Script",
"alwaysRun": false,
"continueOnError": false,
"enabled": true,
"timeoutInMinutes": 0,
"inputs": {
"scriptType": "inlineScript",
"inlineScript": "Write-Host \"Hello World\""
},
"task": {
"id": "e213ff0f-5d5c-4791-802d-52ea3e7be1f1",
"versionSpec": "1.*",
"definitionType": "task"
}
},
{
"displayName": "PowerShell Script",
"alwaysRun": false,
"continueOnError": false,
"enabled": true,
"timeoutInMinutes": 0,
"inputs": {
"scriptType": "inlineScript",
"inlineScript": "Write-Host \"New task\""
},
"task": {
"id": "e213ff0f-5d5c-4791-802d-52ea3e7be1f1",
"versionSpec": "1.*",
"definitionType": "task"
}
}
],
"runsOn": [
"Agent",
"DeploymentGroup"
],
"revision": 2,
"createdBy": {
"id": "4adb1680-0eac-6149-b5ee-fc8b4f6ca227",
"displayName": "Chuck Reinhart",
"uniqueName": "fabfiber@outlook.com"
},
"createdOn": "2017-12-18T08:01:25.24Z",
"modifiedBy": {
"id": "4adb1680-0eac-6149-b5ee-fc8b4f6ca227",
"displayName": "Chuck Reinhart",
"uniqueName": "fabfiber@outlook.com"
},
"modifiedOn": "2017-12-18T08:01:25.893Z",
"comment": "Updated the task group",
"id": "2da4ab36-6fd7-416f-a8ee-5b2a9d3bd61c",
"name": "PowerShell TG1",
"version": {
"major": 1,
"minor": 0,
"patch": 0,
"isTest": false
},
"category": "Deploy",
"definitionType": "metaTask",
"instanceNameFormat": "Task group: TG"
},
{
"tasks": [
{
"displayName": "PowerShell Script",
"alwaysRun": false,
"continueOnError": true,
"enabled": true,
"timeoutInMinutes": 0,
"inputs": {
"scriptType": "inlineScript",
"scriptName": "",
"arguments": "",
"inlineScript": "Write-Host \"Hello World\"",
"workingFolder": "",
"failOnStandardError": "true"
},
"task": {
"id": "e213ff0f-5d5c-4791-802d-52ea3e7be1f1",
"versionSpec": "1.*",
"definitionType": "task"
}
},
{
"displayName": "PowerShell Script",
"alwaysRun": false,
"continueOnError": false,
"enabled": true,
"timeoutInMinutes": 0,
"inputs": {
"scriptType": "inlineScript",
"scriptName": "",
"arguments": "",
"inlineScript": "Write-Host \"New task\"",
"workingFolder": "",
"failOnStandardError": "true"
},
"task": {
"id": "e213ff0f-5d5c-4791-802d-52ea3e7be1f1",
"versionSpec": "1.*",
"definitionType": "task"
}
}
],
"runsOn": [
"Agent",
"DeploymentGroup"
],
"revision": 4,
"createdBy": {
"id": "4adb1680-0eac-6149-b5ee-fc8b4f6ca227",
"displayName": "Chuck Reinhart",
"uniqueName": "fabfiber@outlook.com"
},
"createdOn": "2017-12-18T08:01:36.74Z",
"modifiedBy": {
"id": "4adb1680-0eac-6149-b5ee-fc8b4f6ca227",
"displayName": "Chuck Reinhart",
"uniqueName": "fabfiber@outlook.com"
},
"modifiedOn": "2017-12-18T08:01:43.787Z",
"comment": "Published preview",
"id": "2da4ab36-6fd7-416f-a8ee-5b2a9d3bd61c",
"name": "PowerShell TG1",
"version": {
"major": 2,
"minor": 0,
"patch": 0,
"isTest": false
},
"iconUrl": "https://cdn.vsassets.io/v/20171217T033454/_content/icon-meta-task.png",
"friendlyName": "PowerShell TG1",
"category": "Deploy",
"definitionType": "metaTask",
"instanceNameFormat": "Task group: PowerShell TG1 "
},
{
"tasks": [
{
"displayName": "PowerShell Script",
"alwaysRun": false,
"continueOnError": false,
"enabled": true,
"timeoutInMinutes": 0,
"inputs": {
"scriptType": "inlineScript",
"scriptName": "",
"arguments": "",
"inlineScript": "Write-Host \"Hello World\"",
"workingFolder": "",
"failOnStandardError": "true"
},
"task": {
"id": "e213ff0f-5d5c-4791-802d-52ea3e7be1f1",
"versionSpec": "1.*",
"definitionType": "task"
}
},
{
"displayName": "PowerShell Script",
"alwaysRun": false,
"continueOnError": false,
"enabled": true,
"timeoutInMinutes": 0,
"inputs": {
"scriptType": "inlineScript",
"scriptName": "",
"arguments": "",
"inlineScript": "Write-Host \"New task\"",
"workingFolder": "",
"failOnStandardError": "true"
},
"task": {
"id": "e213ff0f-5d5c-4791-802d-52ea3e7be1f1",
"versionSpec": "1.*",
"definitionType": "task"
}
}
],
"runsOn": [
"Agent",
"DeploymentGroup"
],
"revision": 1,
"createdBy": {
"id": "4adb1680-0eac-6149-b5ee-fc8b4f6ca227",
"displayName": "Chuck Reinhart",
"uniqueName": "fabfiber@outlook.com"
},
"createdOn": "2017-12-17T20:15:04.517Z",
"modifiedBy": {
"id": "4adb1680-0eac-6149-b5ee-fc8b4f6ca227",
"displayName": "Chuck Reinhart",
"uniqueName": "fabfiber@outlook.com"
},
"modifiedOn": "2017-12-17T20:15:04.517Z",
"id": "a4bec09c-4360-45cb-8242-78672fc31a53",
"name": "My PowerShell TG2",
"version": {
"major": 1,
"minor": 0,
"patch": 0,
"isTest": false
},
"friendlyName": "My PowerShell TG2",
"category": "Deploy",
"definitionType": "metaTask",
"instanceNameFormat": "Task group: My PowerShell TG2 "
}
]
}
List all versions of a task group
示例请求
GET https://dev.azure.com/fabrikam/{project}/_apis/distributedtask/taskgroups?api-version=7.1
示例响应
{
"count": 2,
"value": [
{
"tasks": [
{
"displayName": "PowerShell Script",
"alwaysRun": false,
"continueOnError": false,
"enabled": true,
"timeoutInMinutes": 0,
"inputs": {
"scriptType": "inlineScript",
"inlineScript": "Write-Host \"Hello World\""
},
"task": {
"id": "e213ff0f-5d5c-4791-802d-52ea3e7be1f1",
"versionSpec": "1.*",
"definitionType": "task"
}
},
{
"displayName": "PowerShell Script",
"alwaysRun": false,
"continueOnError": false,
"enabled": true,
"timeoutInMinutes": 0,
"inputs": {
"scriptType": "inlineScript",
"inlineScript": "Write-Host \"New task\""
},
"task": {
"id": "e213ff0f-5d5c-4791-802d-52ea3e7be1f1",
"versionSpec": "1.*",
"definitionType": "task"
}
}
],
"runsOn": [
"Agent",
"DeploymentGroup"
],
"revision": 2,
"createdBy": {
"id": "4adb1680-0eac-6149-b5ee-fc8b4f6ca227",
"displayName": "Chuck Reinhart",
"uniqueName": "fabfiber@outlook.com"
},
"createdOn": "2017-12-18T08:01:25.24Z",
"modifiedBy": {
"id": "4adb1680-0eac-6149-b5ee-fc8b4f6ca227",
"displayName": "Chuck Reinhart",
"uniqueName": "fabfiber@outlook.com"
},
"modifiedOn": "2017-12-18T08:01:25.893Z",
"comment": "Updated the task group",
"id": "2da4ab36-6fd7-416f-a8ee-5b2a9d3bd61c",
"name": "PowerShell TG1",
"version": {
"major": 1,
"minor": 0,
"patch": 0,
"isTest": false
},
"category": "Deploy",
"definitionType": "metaTask",
"instanceNameFormat": "Task group: TG"
},
{
"tasks": [
{
"displayName": "PowerShell Script",
"alwaysRun": false,
"continueOnError": true,
"enabled": true,
"timeoutInMinutes": 0,
"inputs": {
"scriptType": "inlineScript",
"scriptName": "",
"arguments": "",
"inlineScript": "Write-Host \"Hello World\"",
"workingFolder": "",
"failOnStandardError": "true"
},
"task": {
"id": "e213ff0f-5d5c-4791-802d-52ea3e7be1f1",
"versionSpec": "1.*",
"definitionType": "task"
}
},
{
"displayName": "PowerShell Script",
"alwaysRun": false,
"continueOnError": false,
"enabled": true,
"timeoutInMinutes": 0,
"inputs": {
"scriptType": "inlineScript",
"scriptName": "",
"arguments": "",
"inlineScript": "Write-Host \"New task\"",
"workingFolder": "",
"failOnStandardError": "true"
},
"task": {
"id": "e213ff0f-5d5c-4791-802d-52ea3e7be1f1",
"versionSpec": "1.*",
"definitionType": "task"
}
}
],
"runsOn": [
"Agent",
"DeploymentGroup"
],
"revision": 4,
"createdBy": {
"id": "4adb1680-0eac-6149-b5ee-fc8b4f6ca227",
"displayName": "Chuck Reinhart",
"uniqueName": "fabfiber@outlook.com"
},
"createdOn": "2017-12-18T08:01:36.74Z",
"modifiedBy": {
"id": "4adb1680-0eac-6149-b5ee-fc8b4f6ca227",
"displayName": "Chuck Reinhart",
"uniqueName": "fabfiber@outlook.com"
},
"modifiedOn": "2017-12-18T08:01:43.787Z",
"comment": "Published preview",
"id": "2da4ab36-6fd7-416f-a8ee-5b2a9d3bd61c",
"name": "PowerShell TG1",
"version": {
"major": 2,
"minor": 0,
"patch": 0,
"isTest": false
},
"iconUrl": "https://cdn.vsassets.io/v/20171217T033454/_content/icon-meta-task.png",
"friendlyName": "PowerShell TG1",
"category": "Deploy",
"definitionType": "metaTask",
"instanceNameFormat": "Task group: PowerShell TG1 "
}
]
}
定义
名称 | 说明 |
---|---|
Authorization |
|
Data |
|
Demand | |
Identity |
|
JObject |
表示 JSON 对象。 |
JToken |
表示抽象 JSON 令牌。 |
Reference |
表示 REST 引用链接集合的类。 |
Task |
|
Task |
|
Task |
|
Task |
|
Task |
|
Task |
|
Task |
按定义的顺序获取结果。 默认值为“CreatedOnDescending”。 |
Task |
表示任务组中的任务。 |
Task |
|
Task |
|
Task |
|
Task |
对任务的引用。 |
Task |
|
Task |
|
Task |
|
Task |
AuthorizationHeader
名称 | 类型 | 说明 |
---|---|---|
name |
string |
获取或设置授权标头的名称。 |
value |
string |
获取或设置授权标头的值。 |
DataSourceBinding
名称 | 类型 | 说明 |
---|---|---|
callbackContextTemplate |
string |
此数据源支持的分页格式(ContinuationToken/SkipTop)。 |
callbackRequiredTemplate |
string |
需要后续调用? |
dataSourceName |
string |
获取或设置数据源的名称。 |
endpointId |
string |
获取或设置终结点 ID。 |
endpointUrl |
string |
获取或设置服务终结点的 URL。 |
headers |
获取或设置授权标头。 |
|
initialContextTemplate |
string |
定义查询参数的初始值 |
parameters |
object |
获取或设置数据源的参数。 |
requestContent |
string |
获取或设置 http 请求正文 |
requestVerb |
string |
获取或设置 http 请求谓词 |
resultSelector |
string |
获取或设置结果选择器。 |
resultTemplate |
string |
获取或设置结果模板。 |
target |
string |
获取或设置数据源的目标。 |
Demand
名称 | 类型 | 说明 |
---|---|---|
name |
string |
|
value |
string |
IdentityRef
名称 | 类型 | 说明 |
---|---|---|
_links |
此字段包含有关图形主题的零个或多个有趣的链接。 可以调用这些链接以获取有关此图形主题的其他关系或更详细的信息。 |
|
descriptor |
string |
描述符是在系统运行时引用图形主题的主要方法。 此字段将唯一标识帐户和组织中的同一图形主题。 |
directoryAlias |
string |
已弃用 - 可以通过查询 IdentityRef“_links”字典的“self”条目中引用的 Graph 用户来检索 |
displayName |
string |
这是图形主题的非唯一显示名称。 若要更改此字段,必须在源提供程序中更改其值。 |
id |
string |
|
imageUrl |
string |
已弃用 - 在 IdentityRef“_links”字典的“虚拟形象”条目中可用 |
inactive |
boolean |
已弃用 - 可以通过查询 GraphUser“_links”字典的“membershipState”条目中引用的 Graph 成员身份状态来检索 |
isAadIdentity |
boolean |
已弃用 - 可以从描述符的主题类型推断(Descriptor.IsAadUserType/Descriptor.IsAadGroupType) |
isContainer |
boolean |
已弃用 - 可以从描述符的主题类型推断(描述符.IsGroupType) |
isDeletedInOrigin |
boolean |
|
profileUrl |
string |
已弃用 - 不在 ToIdentityRef 的大多数预先存在的实现中使用 |
uniqueName |
string |
已弃用 - 请改用 Domain+PrincipalName |
url |
string |
此 URL 是指向此图形主题的源资源的完整路由。 |
JObject
表示 JSON 对象。
名称 | 类型 | 说明 |
---|---|---|
item |
表示抽象 JSON 令牌。 |
|
type |
string (JTokenType) |
获取此 JToken 的节点类型。 |
JToken
表示抽象 JSON 令牌。
名称 | 类型 | 说明 |
---|---|---|
first |
获取此令牌的第一个子令牌。 |
|
hasValues |
boolean |
获取一个值,该值指示此令牌是否具有子令牌。 |
item |
表示抽象 JSON 令牌。 |
|
last |
获取此令牌的最后一个子令牌。 |
|
next |
获取此节点的下一个同级标记。 |
|
parent |
string (JContainer) |
获取或设置父级。 |
path |
string |
获取 JSON 令牌的路径。 |
previous |
获取此节点的上一个同级标记。 |
|
root |
获取此 JToken 的根 JToken。 |
|
type |
string (JTokenType) |
获取此 JToken 的节点类型。 |
ReferenceLinks
表示 REST 引用链接集合的类。
名称 | 类型 | 说明 |
---|---|---|
links |
object |
链接的只读视图。 由于引用链接是只读的,因此我们只想将其公开为只读链接。 |
TaskCommandMode
值 | 说明 |
---|---|
any | |
restricted |
TaskCommandRestrictions
名称 | 类型 | 说明 |
---|---|---|
mode |
TaskDefinitionReference
名称 | 类型 | 说明 |
---|---|---|
definitionType |
string |
获取或设置定义类型。 值可以是“task”或“metaTask”。 |
id |
string (uuid) |
获取或设置任务的唯一标识符。 |
versionSpec |
string |
获取或设置任务的版本规范。 |
TaskExecution
名称 | 类型 | 说明 |
---|---|---|
execTask |
要运行的实用工具任务。 指定这意味着此任务定义只是调用另一个任务的元任务。 这对于调用 powershell 和命令行等实用工具任务的任务非常有用 |
|
platformInstructions |
object |
如果任务要运行代码,则会提供类型/脚本等...按平台提供的信息。 例如,它可能如下所示。 net45: { typeName: “Microsoft.TeamFoundation.Automation.Tasks.PowerShellTask”, assemblyName: “Microsoft.TeamFoundation.Automation.Tasks.PowerShell.dll” } net20: { typeName: “Microsoft.TeamFoundation.Automation.Tasks.PowerShellTask”, assemblyName: “Microsoft.TeamFoundation.Automation.Tasks.PowerShell.dll” } java: { jar: “powershelltask.tasks.automation.teamfoundation.microsoft.com”, } node: { script: “powershellhost.js”, } |
TaskGroup
名称 | 类型 | 说明 |
---|---|---|
agentExecution | ||
author |
string |
|
category |
string |
|
comment |
string |
获取或设置注释。 |
contentsUploaded |
boolean |
|
contributionIdentifier |
string |
|
contributionVersion |
string |
|
createdBy |
获取或设置创建者的标识。 |
|
createdOn |
string (date-time) |
获取或设置创建日期。 |
dataSourceBindings | ||
definitionType |
string |
|
deleted |
boolean |
获取或设置为“true”,以指示为已删除,否则为“false”。 |
demands |
Demand[] |
|
deprecated |
boolean |
|
description |
string |
|
disabled |
boolean |
|
execution |
<string, JObject> |
|
friendlyName |
string |
|
groups | ||
helpMarkDown |
string |
|
helpUrl |
string |
|
hostType |
string |
|
iconUrl |
string |
|
id |
string (uuid) |
|
inputs | ||
instanceNameFormat |
string |
|
minimumAgentVersion |
string |
|
modifiedBy |
获取或设置修改的标识。 |
|
modifiedOn |
string (date-time) |
获取或设置修改日期。 |
name |
string |
|
outputVariables | ||
owner |
string |
获取或设置所有者。 |
packageLocation |
string |
|
packageType |
string |
|
parentDefinitionId |
string (uuid) |
获取或设置父任务组 ID。创建草稿任务组时会用到它。 |
postJobExecution |
<string, JObject> |
|
preJobExecution |
<string, JObject> |
|
preview |
boolean |
|
releaseNotes |
string |
|
restrictions | ||
revision |
integer (int32) |
获取或设置修订。 |
runsOn |
string[] |
|
satisfies |
string[] |
|
serverOwned |
boolean |
|
showEnvironmentVariables |
boolean |
|
sourceDefinitions | ||
sourceLocation |
string |
|
tasks |
获取或设置任务。 |
|
version | ||
visibility |
string[] |
TaskGroupDefinition
名称 | 类型 | 说明 |
---|---|---|
displayName |
string |
|
isExpanded |
boolean |
|
name |
string |
|
tags |
string[] |
|
visibleRule |
string |
TaskGroupQueryOrder
按定义的顺序获取结果。 默认值为“CreatedOnDescending”。
值 | 说明 |
---|---|
createdOnAscending |
按创建顺序升序。 |
createdOnDescending |
按创建降序排序。 |
TaskGroupStep
表示任务组中的任务。
名称 | 类型 | 说明 |
---|---|---|
alwaysRun |
boolean |
获取或设置为“true”以始终运行任务,否则为“false”。 |
condition |
string |
获取或设置任务的条件。 |
continueOnError |
boolean |
获取或设置为“true”以在错误时继续,否则为“false”。 |
displayName |
string |
获取或设置显示名称。 |
enabled |
boolean |
获取或设置为启用或未启用任务。 |
environment |
object |
获取环境变量的字典。 |
inputs |
object |
获取或设置输入的字典。 |
retryCountOnTaskFailure |
integer (int32) |
获取或设置最大重试次数 |
task |
获取或设置任务的引用。 |
|
timeoutInMinutes |
integer (int32) |
获取或设置任务在服务器取消之前允许在代理上执行的最长时间(以分钟为单位)。 零值表示无限超时。 |
TaskInputDefinition
名称 | 类型 | 说明 |
---|---|---|
aliases |
string[] |
|
defaultValue |
string |
|
groupName |
string |
|
helpMarkDown |
string |
|
label |
string |
|
name |
string |
|
options |
object |
|
properties |
object |
|
required |
boolean |
|
type |
string |
|
validation | ||
visibleRule |
string |
TaskInputValidation
名称 | 类型 | 说明 |
---|---|---|
expression |
string |
条件表达式 |
message |
string |
说明验证失败时用户如何更正的消息 |
TaskOutputVariable
名称 | 类型 | 说明 |
---|---|---|
description |
string |
|
name |
string |
TaskReference
对任务的引用。
名称 | 类型 | 说明 |
---|---|---|
id |
string (uuid) |
任务定义的 ID。 对应于 task.json 文件的 ID 值。 |
inputs |
object |
特定于任务定义的输入的字典。 对应于 task.json 文件的输入值。 |
name |
string |
任务定义的名称。 对应于 task.json 文件的名称值。 |
version |
string |
任务定义的版本。 对应于 task.json 文件的版本值。 |
TaskRestrictions
名称 | 类型 | 说明 |
---|---|---|
commands | ||
settableVariables |
TaskSourceDefinition
名称 | 类型 | 说明 |
---|---|---|
authKey |
string |
|
endpoint |
string |
|
keySelector |
string |
|
selector |
string |
|
target |
string |
TaskVariableRestrictions
名称 | 类型 | 说明 |
---|---|---|
allowed |
string[] |
TaskVersion
名称 | 类型 | 说明 |
---|---|---|
isTest |
boolean |
|
major |
integer (int32) |
|
minor |
integer (int32) |
|
patch |
integer (int32) |