构建和发布日志是否在Build Agent计算机上本地保存?我知道我可以手动点击每个构建和发布的“将所有日志下载为zip”链接,但是如果我想自动将这些日志发送给其他人(或批量发送它们),是否有其他方法可以找到它们(在Build Agent机器上还是在某个地方的数据库中??
谢谢!
答案 0 :(得分:3)
对于TFS和VSTS,构建/发布日志都位于 TFS / VSTS服务器(与代理的使用无关)。
在build/release retention中,您可以设置策略以保留构建/发布。它默认保留最近30天'构建和发布。
点击方式除外"将所有日志下载为zip"按钮获取构建/发布日志,您还可以通过REST API获取构建/发布日志。如下例:
GET https://account.visualstudio.com/DefaultCollection/Git2/_apis/build/builds/2373/timeline?api-version=2.0
您可以在响应中获取每个构建步骤,例如:
{
"records": [
{
"id": "d2c6b274-40fe-4727-85b6-eb92fb4f6009",
"parentId": "ff7265dc-abe3-5e6a-6194-76bb88f00044",
"type": "Task",
"name": "Initialize Job",
"startTime": "2018-01-15T05:30:25.6Z",
"finishTime": "2018-01-15T05:30:26.0233333Z",
"currentOperation": null,
"percentComplete": null,
"state": "completed",
"result": "succeeded",
"resultCode": null,
"changeId": 8,
"lastModified": "0001-01-01T00:00:00",
"workerName": "V-myPC",
"order": 2,
"details": null,
"errorCount": 0,
"warningCount": 0,
"url": null,
"log": {
"id": 2,
"type": "Container",
"url": "https://account.visualstudio.com/DefaultCollection/f7855e29-6f8d-429d-8c9b-41fd4d7e70a4/_apis/build/builds/2373/logs/2"
},
"task": null
},
...
],
"lastChangedBy": "00000002-0000-8888-8000-000000000000",
"lastChangedOn": "2018-01-15T05:30:40.947Z",
"id": "4b4280d4-5358-4238-ab95-d44475c92bc9",
"changeId": 19,
"url": "https://account.visualstudio.com/DefaultCollection/f7855e29-6f8d-429d-8c9b-41fd4d7e70a4/_apis/build/builds/2373/Timeline/4b4280d4-5358-4238-ab95-d44475c92bc9"
}
如上面的回复,您可以通过网址https://account.visualstudio.com/DefaultCollection/f7855e29-6f8d-429d-8c9b-41fd4d7e70a4/_apis/build/builds/2373/logs/2找到初始化作业步骤。