如何从 Azure DevOps YAML 文件打印条件调试语句?

Fra*_*era 1 azure-devops

启用调试/诊断时,您会在 Azure Pipeline 日志中看到所有这些条件调试语句。

##[debug]   -NoLogo
##[debug]   -NoProfile
##[debug]   -NonInteractive
##[debug]   -Command
Run Code Online (Sandbox Code Playgroud)

但是如何从 PipeLine YAML 文件、脚本或程序打印这些内容呢?我在 Azure PipeLines日志记录命令文档中看到了通过 powershell 记录警告和错误的示例。

echo "##vso[task.logissue type=error]Something went very wrong."
echo "##vso[task.logissue type=warning;sourcepath=consoleapp/main.cs;linenumber=1;columnnumber=1;code=100;]Found something that could be a problem."
Run Code Online (Sandbox Code Playgroud)

但条件调试详细语句中没有任何内容。

Cec*_*SFT 5

Azure DevOps 中的日志会自动解析。检查以下示例:

# Write your powershell commands here.

Write-Host "##[section] This is colored green!"
Write-Host "##[command] This is colored blue!"
Write-Host "##[debug] This is colored gray!"
Write-Host "##[warning] This is a warning!"
Write-Host "##vso[task.logissue type=warning;]This is another warning" 
Write-Host "##[error] This is an error!"
Write-Host "##vso[task.logissue type=error;]This is another error"
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述