这些逗号在构建风筝中是什么意思



这些命令在构建工具包构建管道中是什么意思?

  • 命令:
  • 命令: |
  • 命令:>-

我正在尝试构建一个构建管道,但我找不到有关它们的任何文档。它们之间有什么区别?

例:

  • 命令: | npm 安装

  • 命令: npm 安装

  • 命令:>- npm 安装

YAML 有多种方法来指定字符串属性:

single-quoted: "a single that can have : and other weird characters"
single-unquoted: another single command (but needs to avoid some special YAML characters, such as ":"
single-split: >
  a single
  line string
  command that's
  broken over
  multiple-lines
multi-line: |
  a
  multi-line
  string

把它放到 https://yaml-online-parser.appspot.com 你可以看到它是如何结束的:

{
  "single-quoted": "a single line command", 
  "single-unquoted": "another single command (but needs to avoid some special YAML characters, such as ":"", 
  "single-split": "a single line string command that's broken over multiple-lines",
  "multi-line": "anmulti-linencommandn"
}

您也可以在此处找到一些相关问题:在 YAML 中,如何断开多行字符串?

这里还有一些例子:https://yaml-multiline.info

以下是 Buildkite pipeline.yml 命令的三种最常见的格式:

command: "simple-command"
command: |
  npm install
  npm test
command:
  - "npm install"
  - "npm test"

(您可以交替使用 commandcommands(

对于最后两个示例,列表中的命令将按顺序运行,一旦其中任何一个失败,就会失败。 即,如果npm install命令失败,作业将立即以失败状态完成。

最新更新