1

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

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

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

例子:

  • 命令:| npm 安装

  • 命令:npm 安装

  • 命令:>- npm 安装

4

1 回答 1

2

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"
}

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

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

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

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

(您可以使用commandcommands互换)

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

于 2019-06-22T01:01:33.553 回答