VSTS:我可以从 Release 定义访问 Build 变量吗? [英] VSTS : Can I access the Build variables from Release definition?

查看:13
本文介绍了VSTS:我可以从 Release 定义访问 Build 变量吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 VSTS CI/CD 中,我正在 CI 的 Powershell 任务中设置一些变量的值.在 CD 期间,我想访问该变量的值以执行某些操作,例如 echo.

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.

这可能吗?如果是这样,如何?

Is this possible? If so, how?

推荐答案

您可以将其写入 json/xml 文件,并将该文件包含在您的构建定义的已发布工件中.然后在您的发布定义中通过 PowerShell 读入该文件.

You could write it out to a json/xml file and include that file in your published artifacts of your build defintion. Then read in that file via PowerShell in your release definition.

ConvertTo-Json | Out-File "file.json"
Get-Content "file.json" | ConvertFrom-Json

这篇关于VSTS:我可以从 Release 定义访问 Build 变量吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆