Azure管道根据条件设置任务的显示名称 [英] Azure pipeline set displayname of task based on condition
问题描述
在构建管道中,我有一个带有powershell脚本的工作,该脚本基于这样的变量来设置应用名称:
In the build pipeline I have a job with a powershell script setting the applicatiuon name based on a variable like this:
$applicationName = If ('$(configuration)' -eq 'Release') { 'Appname' } Else { 'Appname-Test' }
Write-Host "##vso[task.setvariable variable=applicationName]$applicationName"
我尝试将 PublishBuildArtifacts @ 1
变量的显示名称设置为这样的变量:
I try to set the display name of the PublishBuildArtifacts@1
variable to the variable like this:
- task: PublishBuildArtifacts@1
displayName: $[variables.applicationName] # runtime variable
但这实际上显示了 $ [variables.applicationName]
而不是变量值.如何根据变量更改任务的显示名称?
But this literally displays $[variables.applicationName]
instead of the variable value. How can I change the displayname of a task based on a variable?
推荐答案
目前看来这是不可能的.在我发现的两个问题中,他们都将此描述为功能请求.
It doesn't appear that this is currently possible. In both issues I found, they described this as a feature request.
https://github.com/MicrosoftDocs/azure-devops-docs/issues/2327
https://github.com/microsoft/azure-pipelines-yaml/issues/45
这篇关于Azure管道根据条件设置任务的显示名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!