Azure DevOps: How to set the value of the Variable in Variable Group

女生的网名这么多〃 提交于 2021-01-28 00:32:04

问题


I am trying to overwrite the value of the variable from Variable Group in Azure DevOps and it's not working. It's always showing the original value.

I wrote my Powershell scripts as shown by these links:

  • Microsoft
  • StackOverflow

I added the Variable Group and Link it in my Build pipeline.

I wrote the following scripts in Power Shell Script task.

Write-Host "Original BPOwner = $(BPOwner)"

Write-Host "Changing value of BPOwner to Bright Ran"
Write-Host "##vso[task.setvariable variable=BPOwner;]Bright Ran"

Write-Host "New BPOwner = $(BPOwner)"

However, in the Build, it's always showing the original value and it's never changed to the value I want to set.

Could you please suggest me how I could set this value in the Build Pipeline?


回答1:


The new value available only in the next tasks, not in the same task when you change the value. for example, I added another PS task with Write-Host "New BPOwner = $(BPOwner)":

The above it's the behavior of the logging command ##vso[task.setvariable variable] and not only to the variable group.



来源:https://stackoverflow.com/questions/57674793/azure-devops-how-to-set-the-value-of-the-variable-in-variable-group

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!