Azure管道根据条件设置任务的显示名称 [英] Azure pipeline set displayname of task based on condition

查看:51
本文介绍了Azure管道根据条件设置任务的显示名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在构建管道中,我有一个带有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屋!

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