断点配置器

原文


类型:breakpoint

断点配置器将暂停构建,直到用户按下 “enter” 以继续运行构建。这旨在用于调试目的,并允许您在配置过程的特定部分停止。

这与 -debug 标志无关,它会在每个步骤和所有配置器之间停止。

基础用法

source "null" "example" {
  communicator = "none"
}

build {
  sources = ["source.null.example"]

  provisioner "shell-local" {
    inline = ["echo hi"]
  }
  provisioner "breakpoint" {
    disable = false
    note    = "this is a breakpoint"
  }
  provisioner "shell-local" {
    inline = ["echo hi 2"]
  }
}

配置参数

可选

  • disable (boolean) - 如果为 true,则跳过断点。当您设置了多个断点并想要关闭或打开它们时很有用。默认值:false
  • note (string) - 一个用于解释断点的目的或位置的字符串。例如,您可能会发现对断点进行编号或使用有关断点在构建中出现位置的信息来标记它们很有用

以下是对所有配置器都生效的通用参数:

  • pause_before (duration) - 执行前休眠一段时间。
  • max_retries (int) - provisioner 在失败的情况下重试的最大次数。默认为零 (0)。零表示不会重试错误。
  • only (array of string) - 仅在列出名字的构建器上运行配置程序。
  • override (object) - 修改特定构建器的配置,例如:
source "null" "example1" {
  communicator = "none"
}

source "null" "example2" {
  communicator = "none"
}

build {
  sources = ["source.null.example1", "source.null.example2"]
  provisioner "shell-local" {
    inline = ["echo not overridden"]
    override = {
      example1 = {
        inline = ["echo yes overridden"]
      }
    }
  }
}
  • timeout(duration)- 如果配置器完成时间超过 1h10m1s10m,则配置器将超时并失败。

用例

在您希望构建暂停的位置插入此配置器。当您准备好时,您会看到 ui 输出提示您按 “enter” 继续构建。

例如:

==> docker: Pausing at breakpoint provisioner with note "foo bar baz".
==> docker: Press enter to continue.

一旦按下回车键,构建将恢复并正常运行,直到它完成或出错。

results matching ""

    No results matching ""