我可以将自定义任务开始/结束记录写入VSTS构建/发布日志 [英] Can I write custom task start/end records to VSTS build/release log

本文介绍了我可以将自定义任务开始/结束记录写入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个问题

  1. 我应该从上面的示例脚本中看到什么?
  2. 是否有可能 初始屏幕快照中显示的该日志中的其他条目 无需实际添加其他任务?
  1. What should I see from my sample script above?
  2. 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

这篇关于我可以将自定义任务开始/结束记录写入VSTS构建/发布日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆