gpt4 book ai didi

AzureDevops - 如何根据依赖于先前代理的自定义条件执行发布管道代理

转载 作者:行者123 更新时间:2023-12-02 08:32:21 27 4
gpt4 key购买 nike

我的发布管道中有 2 个代理。第二个代理应仅根据第一个代理的输出运行。

第一个代理有以下代码

ssh task:

echo "##vso[task.setvariable variable=isNextExecutable;isOutput=true]true"

第二个代理具有以下自定义条件

and(succeeded(), eq(variables[isNextExecutable], 'true'))

此外,我尝试使用 API 更新环境变量(随后 How to modify Azure DevOps release definition variable from a release task? )但只有发布管道完成后,变量才会更新。

我的问题:

1) 如何根据第一个代理输出的自定义条件执行代理?

2) 是否可以在任务级别添加多个自定义条件?如果前一个任务成功执行并且基于同一代理中前一个任务中设置的某个值,则该任务应该执行。

最佳答案

How to execute the agent based on the custom condition based on the first agent output?

对于这个问题,如果你没有使用yaml发布管道,恐怕这是不可能的。

Note that the updated variable value is scoped to the job being executed, and does not flow across jobs or stages.

官方document中有说明。您可以尝试创建multi stage Azure DevOps 中带有 YAML 的管道,以便您可以使用 multi-job output variables在作业之间传递变量值。

作为解决方法,您可以在发布定义中定义一个变量,然后使用 REST API(定义 - 更新)更新代理作业中发布定义变量的值 1,使用发布定义的更新值下一个agent作业中的变量,具体请引用this .

Is it possible to add multiple custom condition on the task level?

对于这个问题,答案是,你只需要使用这样的脚本 ##vso[task.setvariable variable={variableName};isOutput=true]{variableValue} 将其输出到以下任务。

enter image description here

在以下任务中: enter image description here

enter image description here

关于AzureDevops - 如何根据依赖于先前代理的自定义条件执行发布管道代理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59680439/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com