我可以将自定义任务开始/结束记录写入VSTS构建/发布日志
我希望能够将项目添加到VSTS构建和发布期间显示的日志中:
I would like to be able to add items to the logs displayed during VSTS builds and releases:
我已经查看了此页面并编写了以下测试powershell脚本
I've looked at this page and written the following test powershell script
$guid = $env:taskGuid
write-host "##vso[task.logdetail id=$guid;name=project1;type=build;order=1]create new timeline record"
# write-host "##vso[task.logdetail id=new guid;parentid=exist timeline record guid;name=project1;type=build;order=1]create new nested timeline record"
write-host "##vso[task.logdetail id=$guid;progress=50;state=InProgress;]update timeline record"
write-host "##vso[task.logdetail id=$guid;state=Completed;result=Succeeded]complete timeline record"
我希望在日志中看到其他条目,但我什至没有看到任何区别,甚至没有出现write-host
语句.
I was hoping to see additional entries in the log but I see no difference at all, not even the write-host
statements appearing.
所以我有2个问题
- 我应该从上面的示例脚本中看到什么?
- 是否有可能 初始屏幕快照中显示的该日志中的其他条目 无需实际添加其他任务?
- What should I see from my sample script above?
- Is it possible to get additional entries in that log shown in the initial screenshot without actually adding additional tasks?
您正在使用的语法旨在显示在时间轴上,而该时间轴似乎尚未在新的构建布局中使用(请参见.请参见此处,以获得比各种构建步骤更好的运行记录.我可以给.
The syntax you're using is designed to show in the timeline which doesn't appear to be used in the new build layout yet (see . See here for a better run down of the various build steps than I could give.
For just outputting the the logs you can use a variety of writers provided in PowerShell utilities Write-Host should be sufficient so long as you always have a host to write to. These will then appear in your logs