TFS 写入字符串消息以构建摘要 [英] TFS write string message to build summary

查看:26
本文介绍了TFS 写入字符串消息以构建摘要的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将字符串消息写入 TFS 构建摘要.我有一个带有变量的 Powershell 任务

 $output = $(Build.SourcesDirectory)\scripts\SCRIPT_NAME.ps1$输出

持有

 ======麻木的.打补丁的文件:Win32 = 2Win64 = 123---麻木的.原始文件:Win32 = 0Win64 = 12======

那个方案是一个完整的信息,现在我只想将它显示在图片下方的位置或任何其他部分,只要它在摘要"中我查看了

<小时>

此外,您还可以创建自己的扩展以在我的 Azure DevOps 构建摘要页面中显示图形内容.(太复杂,不推荐)

例如,通过您的扩展程序在构建结果中添加自定义部分,通过这种方式,您可以在该自定义部分中添加 html 测试结果报告.有关于构建结果扩展的示例:

I want to write string message to TFS build summary. I have a Powershell task with variable

   $output = $(Build.SourcesDirectory)\scripts\SCRIPT_NAME.ps1

   $output

that holds

   =====
   Numb. of files for patch in:
   Win32 = 2
   Win64 = 123
   ---
   Numb. of original files:
   Win32 = 0
   Win64 = 12
   =====

that scheme is a whole message, now I just want to display it in a place that picture below points or in any other section as long as it is in "Summary" I took a look on this Stack question but it answers how to display hyperlink to file. I want to specifically display string not a link to file that holds what I want to print. Additionally I referred to Microsoft docs but I haven't found what I'm looking for

解决方案

The simple way is just using Logging Commands as your shared link suggested:

##vso[task.uploadsummary]local file path

Upload and attach summary markdown to current timeline record. This summary shall be added to the build/release summary and not available for download with logs.

This will not generate hyperlink in summary, it will directly list the text/content in the shared file on build Summary page. You just need to put the output in a file, then use above command lin.

For example:

  1. Add PowerShell task

Script:

Write-Host "##vso[task.uploadsummary]c:\testsummary.md"


Besides, you could also create your own extension to display graphical content in my Azure DevOps build summary page. (Too complicated, not recommend)

For example add a custom section in build result through your extension, with this way, you can add html test results report in that custom section. There is the sample about build result extension: vsts-extension-samples

More information about how to build extension, you can refer to this article

Create your first extension for Visual Studio Team Services

A extension for your reference Publish HTML Artifact


Update

In md files for Markdown format you could use </br> to wrap next line. Start a line with a hash character # to set a heading. For example

=====</br>Processed files statistics </br>Numb. of files for patch in: Win32 = 2 [this is single line]</br> #Win64 = 123 [this is header] </br>[here split to lines rest of report]</br>===== 

Then the result format of report you could check right part:

这篇关于TFS 写入字符串消息以构建摘要的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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