问题描述
使用Azure Devops 2019 Server(本地)
因此,我希望仅在IsServiceInstalled
变量为0时运行名为“ Install”的无代理作业,才能运行。我只能在同一作业(代理)中使用此变量,而不能在其他作业中使用此变量。 (无代理)。
无论我做什么,我都会收到一条异常声明:
Exception Message: Unrecognized value: 'dependencies'. Located at position 21 within expression: and(succeeded(),eq(<whatever i try to put here>,0))
设置变量的代码:
#Sets IsServiceInstalled to determine if service must be installed or updated
Get-Service "$(RabbitMQServiceName)" -ErrorAction SilentlyContinue
if ($?) {
echo "##vso[task.setvariable variable=IsServiceInstalled;isOutput=true]1"
} else {
echo "##vso[task.setvariable variable=IsServiceInstalled;isOutput=true]0"
}
- 我知道我可以使用“依赖关系”。访问该变量。 Use the output variable from a job in a condition in a subsequent job。但是我没有命名Job的选项。
- 我使用
system.debug=true
运行了部署,并发现了[SYSTEM_JOBNAME] --> [__default]
-因此,我尝试使用and(succeeded(),eq(dependencies.__default.Outputs['IsServiceInstalledTask.IsServiceInstalled'],0))
进行设置-是的,我收到了例外情况Unrecognized value: 'dependencies'
-并不奇怪我从未指定依赖项,也看不到在UI中的什么位置。 - 我没有设置Job Name的选项,因此我尝试设置在调试日志中找到的各种值(__default是我希望从中获取输出变量的Jobname):
Stage_cb7edb91b40b4747845ae3564bf62723_2_9.Phase_1.__default...
,{{1 }}或Phase_1.__default...
无论我尝试什么,都会遇到相同的无法识别的值异常。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)