我试图在 YAML 模板上创建一个变量(组),前提是某个参数具有值。我正在使用以下代码片段:
variables:
- name: variableGroupName
value: app-${{parameters.environmentInitials}}
- template: /pipelines/variables/${{parameters.environmentInitials}}.yml
- group: ${{variables.variableGroupName}}
${{if parameters.parentEnvironmentInitials}}:
- group: app-${{parameters.parentEnvironmentInitials}}
Run Code Online (Sandbox Code Playgroud)
然而,当我尝试触发管道时,我收到错误:
Encountered error(s) while parsing pipeline YAML: Expected a mapping - Unexpected state while attempting to read the mapping end. State:
SequenceState:
IsStart: False
Index: 3
IsEnd: True
MappingState:
IsStart: False
Index: 3
IsKey: False
IsEnd: False
SequenceState:
IsStart: False
Index: 0
IsEnd: False
MappingState:
IsStart: False
Index: 0
IsKey: False
IsEnd: False
Run Code Online (Sandbox Code Playgroud)
我已经尝试了几种组合,因为我找不到声明具有条件的组但没有成功的示例,有什么想法吗?
谢谢