3

I want to update a pipeline variable once my task is finished. Can I do it through output variable section provided in azure DevOps?

enter image description here

The main objective is to let downstream tasks know that the list of specific previous tasks have succeeded, which I can check by adding custom conditions.

enter image description here

riQQ
  • 9,878
  • 7
  • 49
  • 66
Mehul Parmar
  • 347
  • 4
  • 21
  • Not get your latest information, is the workaround helpful for you? Or if you have any concern, feel free to share it here. – Hugh Lin Sep 25 '20 at 01:38

1 Answers1

4

If your tasks are in an agent job, there is no need to use the output variable section, just add a Powershell task after the successful task, you can overwrite/update the value of the variables by using the logging command to set the variables again in Azure Devops pipeline.

Write-Host "##vso[task.setvariable variable={variableName}]{updateValue}"

To set a variable from a script, you use the task.setvariable logging command. This doesn't update the environment variables, but it does make the new variable available to downstream steps within the same job. In addition ,here is a reference.

Hugh Lin
  • 17,829
  • 2
  • 21
  • 25