如何在 azure 发布管道中跨代理作业使用输出变量 [英] How to use output variables across agent jobs in azure release pipeline
问题描述
在我的 azure 发布管道中,我有 2 个代理作业,一个用于使用 power-shell 的 sql 部署,另一个用于使用 power-shell 的 kubernetes.如何在第一个代理作业中设置输出变量并使用 power-shell 在第二个代理作业中使用该变量.
In my azure release pipeline I have 2 agent jobs, one is for sql deployment using power-shell and other is for kubernetes using power-shell. How to set an output variable in 1st agent job and use that in second agent job using power-shell.
推荐答案
如何在 azure 发布管道中跨代理作业使用输出变量
How to use output variables across agent jobs in azure release pipeline
恐怕目前无法直接跨代理作业使用输出变量.
I am afraid there is no way to use output variables across agent jobs directly for now.
有一个相关的问题 通过日志命令设置的变量在代理之间不持久s,你可以跟进.
There is a related issue Variables set via logging commands are not persistent between agents, you can follow up.
要解决此问题,您可以尝试以下解决方法:
To resolve this problem, you can try following workaround:
- 在发布定义变量中定义一个变量.
- 使用 REST API(Definitions - Update) 更新发布的值代理作业 1 中的定义变量.
- 在下一个代理作业中使用发布定义变量的更新值.
- Define a variable in the release definition Variable.
- Use REST API (Definitions - Update) to update the value of the release definition variable in the agent job 1.
- Use the updated value of the release definition variable in the next agent job.
有关使用 REST API 更新发布定义变量值的详细信息,您可以按照以下票证操作:
The details info about using REST API to update the value of the release definition variable, you can follow the below ticket:
如何从发布任务修改 Azure DevOps 发布定义变量?
希望这会有所帮助.
这篇关于如何在 azure 发布管道中跨代理作业使用输出变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!