In your script, you are trying to move the value to the time variable but you do not use it.
You can not use a new value of a pipeline variable in the same step through the pipeline variable reference. If you pass a new value with Write-Host "##vso... myvar]$somevalue" you may print it in some next build step: Write-Host "$(myvar)"
Even though you could change the initial value of your variables during the pipeline running, I suppose that the variable value you defined in the ui could not be updated after finishing.
If you are going to pass the variables between stages, I suppose that you could refer to output variables.
Update on 1/2
=========================================
After more tests, i realized that stages of release pipelines are run on different agents, and output variables could not be a good choice for you.
If you are going to pass and update the value of your variable between different stages, I suppose that yaml could be the better choice instead of release pipeline.
2
Answers
time
variable but you do not use it.Write-Host "##vso... myvar]$somevalue"
you may print it in some next build step:Write-Host "$(myvar)"
Check the documentation:
Even though you could change the initial value of your variables during the pipeline running, I suppose that the variable value you defined in the ui could not be updated after finishing.
If you are going to pass the variables between stages, I suppose that you could refer to output variables.
Update on 1/2
=========================================
After more tests, i realized that stages of release pipelines are run on different agents, and output variables could not be a good choice for you.
If you are going to pass and update the value of your variable between different stages, I suppose that yaml could be the better choice instead of release pipeline.