如何基于哪个代理正在运行Azure DevOps构建管道来设置变量?

问题描述

我们有多个自托管的构建代理。我们的构建管道之一的步骤是将一些工件复制到网络驱动器。我们通过PowerShell脚本执行此操作,该脚本将目标作为参数。我们希望此目的地根据运行管道的代理(或代理池)而有所不同。

我想将用户定义的功能添加到指定此路径的代理中,但是您不能在管道中将其用作变量。

我也尝试过:

parameters:
- name: PoolName
  displayName: Pool Name
  type: string
  default: Pool A
  values:
  - Pool A
  - Pool B

pool:
  name: ${{ parameters.PoolName }}

variables:
  ${{ if eq(parameters.PoolName,'Pool A') }}:
      BuildArchiveLocation:  'foo'
  ${{ if eq(parameters.PoolName,'Pool B') }}:
      BuildArchiveLocation:  'bar'

但是在A template expression is not allowed in this context行收到了name: ${{ parameters.PoolName }}

有什么好方法吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)