hashicorp / hashicorp/packer

Add debug option for on-error

Open
#12,233 0 comments 2 reactions 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
15.8k
Forks
3.3k
PR merge metrics
PR metrics pending

Description

#### Community Note

* Please vote on this issue by adding a 👍 [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to the original issue to help the community and maintainers prioritize this request
* Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
* If you are interested in working on this issue or have submitted a pull request, please leave a comment

Please search the existing issues for relevant feature requests, and use the
reaction feature
(https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/)
to add upvotes to pre-existing requests.

#### Description

Allow debug access to build only when a step has an error.

#### Use Case(s)

When running packer with `-debug` a PEM file is created to allow SSH into the instance for debugging, however you have to monitor the build and step through each step to get where you need to be before the build is paused and you can use the PEM file to SSH into the instance. This is great for general debugging, however if you have a single problem that occurs much later in build you have to manually step through each step.

Adding a `debug` option to `on-error` can do exactly the same, but only after any step fails.

So when the step fails, a PEM is written to disk and steps paused to allow debugging.

#### Potential configuration

```
packer build -on-error=abort packer.file
```

#### Potential References

* [Debugging Packer Builds](https://developer.hashicorp.com/packer/docs/debugging)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.