packer-cn/website/content/docs/provisioners/breakpoint.mdx

111 lines
2.3 KiB
Plaintext

---
description: >
The breakpoint provisioner will pause until the user presses "enter" to resume
the build. This is intended for debugging purposes, and allows you to halt at
a
particular part of the provisioning process.
page_title: breakpoint - Provisioners
sidebar_title: Breakpoint
---
# Breakpoint Provisioner
Type: `breakpoint`
The breakpoint provisioner will pause until the user presses "enter" to resume
the build. This is intended for debugging purposes, and allows you to halt at a
particular part of the provisioning process.
This is independent of the `-debug` flag, which will instead halt at every step
and between every provisioner.
## Basic Example
<Tabs>
<Tab heading="JSON">
```json
{
"builders": [
{
"type": "null",
"communicator": "none"
}
],
"provisioners": [
{
"type": "shell-local",
"inline": "echo hi"
},
{
"type": "breakpoint",
"disable": false,
"note": "this is a breakpoint"
},
{
"type": "shell-local",
"inline": "echo hi 2"
}
]
}
```
</Tab>
<Tab heading="HCL2">
```hcl
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"]
}
}
```
</Tab>
</Tabs>
## Configuration Reference
### Optional
- `disable` (boolean) - If `true`, skip the breakpoint. Useful for when you
have set multiple breakpoints and want to toggle them off or on. Default:
`false`
- `note` (string) - a string to include explaining the purpose or location of
the breakpoint. For example, you may find it useful to number your
breakpoints or label them with information about where in the build they
occur
@include 'provisioners/common-config.mdx'
## Usage
Insert this provisioner wherever you want the build to pause. You'll see ui
output prompting you to press "enter" to continue the build when you are ready.
For example:
```shell-session
==> docker: Pausing at breakpoint provisioner with note "foo bar baz".
==> docker: Press enter to continue.
```
Once you press enter, the build will resume and run normally until it either
completes or errors.