VSTS : Can I access the Build variables from Release definition?

后端 未结 3 1789
被撕碎了的回忆
被撕碎了的回忆 2020-12-10 20:31

In VSTS CI/CD , I am setting some variable\'s value in a Powershell task in CI. During CD I want to access that variable\'s value to do something , lets say echo.

I

3条回答
  •  执念已碎
    2020-12-10 20:57

    For VSTS itself, it can not persists variables from build to release.

    An workaround is store the variable’s value in Variable Group and link the variable group into your release definition. Detail steps as below:

    • During build, you can Add a variable group with the name group-$(Build.BuildId), and store the variable you want to transfer in the variable group.

    • During release, you can get variable groups firstly, and filter the variable under the variable group-$(Build.BuildId). And delete the group group at the end of the release.

    Besides, if artifact type is build for your release definition, you can also store the variable value in a file and then publish the file as build artifacts (as Calidus says).

提交回复
热议问题