Azure yaml - 换行符支持

Chu*_*dad 11 azure-pipelines

我的 azure devops yaml 文件中有很长的行,例如

condition: and(succeeded(), or(eq(variables['SomeStep.IsScheduledBuild'], 'True'), eq(variables['userOverride.Setting1'], 'yes'), .......))
Run Code Online (Sandbox Code Playgroud)

对于如此长时间运行的条件,换行符是什么,以便上面的 yml 文件条件可以整齐地放置在多行中?

谢谢

小智 13

换行符是什么

它应该是|

请参考下面的yaml:

- task: CmdLine@2
  condition: |
   and(succeeded(), or(eq(variables['SomeStep.IsScheduledBuild'], 'True'),
   eq(variables['userOverride.Setting1'], 'yes')))
  inputs:
    script: |
      echo Write your commands here
      echo Hello world
Run Code Online (Sandbox Code Playgroud)

|在后面加上一个,condition:您可以将表达式分成多行。