在Googlecloudbuild.yaml中,什么是-|争论?

In Google cloudbuild.yaml, what is the - | argument?

cloudbuild教程中Google示例cloudbuild.yaml使用- |作为论点之一。

  args:
  - '-c'
  - |
      if [ -d "environments/$BRANCH_NAME/" ]; then
...

'-|'的用途是什么

该字符称为“文字块标量”,用于将值跨越多行。跨越 | 将包括换行符和任何尾随空格。您也可以使用 > 进行跨接,但这会将新行折叠成空格。

示例:

include_newlines: |
        exactly as you see
        will appear these three
        lines of poetry     

fold_newlines: >
        this is really a
        single line of text
        despite appearances

如果想了解更多yaml语法,可以访问this for information that may not be included in the cloud build documentation.