【问题标题】:What are these comands mean in buildkite?这些命令在 buildkite 中是什么意思?
【发布时间】:2019-11-04 05:43:29
【问题描述】:

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

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

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

示例:

  • 命令:| npm 安装

  • 命令:npm install

  • 命令:>- npm install

【问题讨论】:

    标签: node.js yaml pipeline buildkite


    【解决方案1】:

    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 pipeline.yml 命令最常见的三种格式:

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

    commandcommands可以互换使用)

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-04-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-11
      相关资源
      最近更新 更多