Records - Update

更新时间线记录(如果它们已存在),否则为同一时间线创建新记录。

PATCH https://dev.azure.com/{organization}/{scopeIdentifier}/_apis/distributedtask/hubs/{hubName}/plans/{planId}/timelines/{timelineId}/records?api-version=7.1

URI 参数

名称 必需 类型 说明
hubName
path True

string

服务器中心的名称。 常见示例:“build”、“rm”、“checks”

organization
path True

string

Azure DevOps 组织的名称。

planId
path True

string (uuid)

计划的 ID。

scopeIdentifier
path True

string (uuid)

用于限定请求范围的项目 GUID

timelineId
path True

string (uuid)

时间线的 ID。

api-version
query True

string

要使用的 API 版本。 这应设置为“7.1”才能使用此版本的 API。

请求正文

名称 类型 说明
count

integer (int32)

序列化项的数目。

value

string (T)

序列化的项。

响应

名称 类型 说明
200 OK

TimelineRecord[]

成功作

安全性

accessToken

个人访问令牌。 将用户名和令牌的任何值用作密码。

类型: basic

示例

Update timeline's records

示例请求

PATCH https://dev.azure.com/{organization}/{scopeIdentifier}/_apis/distributedtask/hubs/{hubName}/plans/{planId}/timelines/{timelineId}/records?api-version=7.1

{
  "value": [
    {
      "id": "5e6d5dbf-ac69-5f56-8b85-8e9038703a8b",
      "parentId": null,
      "type": null,
      "name": null,
      "startTime": null,
      "finishTime": null,
      "currentOperation": null,
      "percentComplete": null,
      "state": null,
      "result": null,
      "resultCode": null,
      "changeId": 0,
      "lastModified": "0001-01-01T00:00:00",
      "workerName": null,
      "log": {
        "path": "logs\\5e6d5dbf-ac69-5f56-8b85-8e9038703a8b",
        "createdOn": "0001-01-01T00:00:00",
        "lastChangedOn": "0001-01-01T00:00:00",
        "id": 0,
        "location": null
      },
      "details": null,
      "errorCount": null,
      "warningCount": null,
      "location": null,
      "attempt": 1,
      "identifier": null
    }
  ],
  "count": 1
}

示例响应

{
  "count": 1,
  "value": [
    {
      "id": "5e6d5dbf-ac69-5f56-8b85-8e9038703a8b",
      "parentId": "096e11e7-c8bb-5a90-1a73-4e639c9ea0f9",
      "type": "Task",
      "name": "Invoke REST API",
      "startTime": "2022-12-02T09:33:15.0466667Z",
      "finishTime": "2022-12-02T09:37:37.8433333Z",
      "currentOperation": null,
      "percentComplete": null,
      "state": "completed",
      "result": "succeeded",
      "resultCode": null,
      "changeId": 13,
      "lastModified": "0001-01-01T00:00:00",
      "workerName": null,
      "order": 1,
      "refName": "InvokeRESTAPI0",
      "log": {
        "id": 0,
        "location": "https://dev.azure.com/fabrikam/_apis/distributedtask/plans/787562d7-f1da-59cf-22c4-8a94fa784503/logs/0"
      },
      "details": null,
      "errorCount": 0,
      "warningCount": 0,
      "task": {
        "id": "9c3e8943-130d-4c78-ac63-8af81df62dfb",
        "name": "InvokeRESTAPI",
        "version": "1.198.0"
      },
      "location": "https://dev.azure.com/fabrikam/_apis/distributedtask/plans/787562d7-f1da-59cf-22c4-8a94fa784503/timelines/787562d7-f1da-59cf-22c4-8a94fa784503/records/5e6d5dbf-ac69-5f56-8b85-8e9038703a8b",
      "attempt": 1,
      "identifier": null
    }
  ]
}

定义

名称 说明
Issue

与管道运行关联的问题(错误、警告)。

IssueType

问题的类型(错误、警告)。

JObject

表示 JSON 对象。

TaskLogReference

对任务日志的引用。 此类包含有关管道运行期间输出到时间线记录日志控制台的信息。

TaskReference

对任务的引用。

TaskResult
TimelineAttempt

尝试更新 TimelineRecord。

TimelineRecord

有关管道运行期间执行不同作的详细信息。

TimelineRecordState

记录的状态。

TimelineReference

对时间线的引用。

VariableValue

泛型变量的包装类。

VssJsonCollectionWrapper

此类用于将集合序列化为网络上的单个 JSON 对象。

Issue

与管道运行关联的问题(错误、警告)。

名称 类型 说明
category

string

问题的类别。
示例:代码 - 指编译错误
示例:常规 - 指泛型错误

data

object

包含有关该问题的详细信息的字典。

message

string

问题的说明。

type

IssueType

问题的类型(错误、警告)。

IssueType

问题的类型(错误、警告)。

说明
error
warning

JObject

表示 JSON 对象。

名称 类型 说明
item

string (JToken)

type

string (JTokenType)

获取此 JToken 的节点类型。

TaskLogReference

对任务日志的引用。 此类包含有关管道运行期间输出到时间线记录日志控制台的信息。

名称 类型 说明
id

integer (int32)

任务日志的 ID。

location

string

任务日志的 REST URL。

TaskReference

对任务的引用。

名称 类型 说明
id

string (uuid)

任务定义的 ID。 对应于 task.json 文件的 ID 值。
示例:CmdLineV2 { “id”: “D9BAFED4-0B18-4F58-968D-86655B4D2CE9” }

inputs

object

特定于任务定义的输入的字典。 对应于 task.json 文件的输入值。

name

string

任务定义的名称。 对应于 task.json 文件的名称值。
示例:CmdLineV2 { “name”: “CmdLine” }

version

string

任务定义的版本。 对应于 task.json 文件的版本值。
示例:CmdLineV2 { “version”: { “Major”: 2, “Minor”: 212, “Patch”: 0 } }

TaskResult

说明
abandoned
canceled
failed
skipped
succeeded
succeededWithIssues

TimelineAttempt

尝试更新 TimelineRecord。

名称 类型 说明
attempt

integer (int32)

记录的尝试。

identifier

string

记录的唯一标识符。

recordId

string (uuid)

位于指定时间线内的记录标识符。

timelineId

string (uuid)

拥有表示此尝试的记录的时间线标识符。

TimelineRecord

有关管道运行期间执行不同作的详细信息。

名称 类型 说明
agentSpecification

JObject

运行管道作业的代理的规范,采用二进制格式。 如果记录的类型为 Job,则适用。
示例: { “VMImage” : “windows-2019” }

attempt

integer (int32)

记录尝试次数。

changeId

integer (int32)

连接所有记录的 ID 同时更新。 此值取自时间线的 ChangeId。

currentOperation

string

指示当前作的字符串。

details

TimelineReference

对子时间线的引用。

errorCount

integer (int32)

此作生成的错误数。

finishTime

string (date-time)

记录的完成时间。

id

string (uuid)

记录的 ID。

identifier

string

尝试之间一致的字符串标识符。

issues

Issue[]

此作生成的问题列表。

lastModified

string (date-time)

上次修改记录的时间。

location

string

记录的 REST URL。

log

TaskLogReference

对此作生成的日志的引用。

name

string

记录的名称。

order

integer (int32)

相对于时间线中的其他记录的序号值。

parentId

string (uuid)

记录的父级的 ID。
示例:阶段是阶段的父级,阶段是作业的父级,作业是任务的父级。

percentComplete

integer (int32)

记录完成百分比。

previousAttempts

TimelineAttempt[]

上一条记录尝试。

queueId

integer (int32)

将项目连接到运行作的代理池的队列的 ID。 如果记录的类型为 Job,则适用。

refName

string

引用的记录的名称。

result

TaskResult

记录的结果。

resultCode

string

在完成记录的作时评估预定义的条件。
示例:计算 succeeded(),结果 = True
示例:计算 and(succeeded(), eq(variables['system.debug'], False)),结果 = False

startTime

string (date-time)

记录的开始时间。

state

TimelineRecordState

记录的状态。

task

TaskReference

对任务的引用。 如果记录的类型为 Task,则适用。

type

string

记录跟踪的作的类型。
示例:阶段、阶段、作业、任务...

variables

<string,  VariableValue>

记录的变量。

warningCount

integer (int32)

此作生成的警告数。

workerName

string

运行作的代理的名称。 如果记录的类型为 Job,则适用。

TimelineRecordState

记录的状态。

说明
completed
inProgress
pending

TimelineReference

对时间线的引用。

名称 类型 说明
changeId

integer (int32)

更改 ID。

id

string (uuid)

时间线的 ID。

location

string

时间线的 REST URL。

VariableValue

泛型变量的包装类。

名称 类型 说明
isReadOnly

boolean

指示是否可以在脚本的执行运行时期间更改变量。

isSecret

boolean

指示是否应静态加密变量。

value

string

变量的值。

VssJsonCollectionWrapper

此类用于将集合序列化为网络上的单个 JSON 对象。

名称 类型 说明
count

integer (int32)

序列化项的数目。

value

string (T)

序列化的项。