我在 Azure DevOps 中有一个管道,用于构建我的 iOS 应用程序,我想根据作业和条件将环境与我正在构建的应用程序分开。我已经设置了初始参数选择:
parameters:
- name: Environment
displayName: "Environment"
type: string
default: Dev
values:
- Dev
- Live
- name: Build
displayName: "Build"
type: string
default: iPhone
values:
- iPhone
- iPhoneSimulator
Run Code Online (Sandbox Code Playgroud)
然后我在设置不同的工作时添加了一个条件:
- job:
condition: and(succeeded(), eq(${{ parameters.Build }}, iPhone))
steps:
- checkout: none
Run Code Online (Sandbox Code Playgroud)
当我尝试运行此程序时,出现以下错误:
An error occurred while loading the YAML build pipeline. Unrecognized value: 'iPhone'. Located at position 21 within expression: and(succeeded(), eq(iPhone, iPhone)).
Run Code Online (Sandbox Code Playgroud)
fly*_*lyx 14
iPhone不是有效的文字。由于参数扩展发生在条件评估之前,因此您需要通过将字符串文字括在单引号中来确保参数扩展后条件具有正确的语法:
and(succeeded(), eq('${{ parameters.Build }}', 'iPhone'))
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
10704 次 |
| 最近记录: |