Passing release variables between two agent phases

前端 未结 4 1411
情歌与酒
情歌与酒 2020-12-17 19:31

I\'m working with TFS on-premise. My issue is that during a release I have two agent phases separated by a manual intervention.

In the first agent phase, I set a var

4条回答
  •  情书的邮戳
    2020-12-17 20:09

    You can share a variable between the agent phases by using the TFS Rest API and creating a new variable in the release.

    You can create a helper module to facilitate this task.

    1. Get the release by using the environment variable $Env:Release_ReleaseId.
    2. Add a NoteProperty, using Add-Member, to the variables hashtable of the release returned in step 1, where the name is your desired variable name and the value is a ConfigurationVariableValue.
    3. Save the release with the added variable.

    In order to use this approach, you would set the variable in your first agent. Then, in the second agent, you can simply read the TFS variable using the $(VariableName) semantic.

提交回复
热议问题