这些命令在buildkite中是什么意思?

时间:2019-06-21 11:12:00

标签: node.js yaml pipeline buildkite

这些命令在buildkit构建管道中意味着什么?

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

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

示例:

  • 命令:|   npm install

  • 命令:npm install

  • 命令:>-npm install

1 个答案:

答案 0 :(得分:0)

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": "a\nmulti-line\ncommand\n"
}

您也可以在此找到一些相关问题:In YAML, how do I break a string over multiple lines?

这里还有更多示例: https://yaml-multiline.info

这是Buildkite管道的三种最常见格式。yml命令如下:

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

(您可以互换使用commandcommands

对于后两个示例,列表中的命令将按顺序运行,并且一旦其中任何一个失败,该命令就会失败。也就是说,如果npm install命令失败,则作业将立即以失败状态结束。