Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core/hcl2: Fix issue preventing builds from pausing between provisioners when the --debug argument has been passed #11537

Merged
merged 2 commits into from Feb 3, 2022

Conversation

nywilken
Copy link
Member

This change fixes the debug mode settings for HCL2 builds by calling SetDebug mode for CoreBuild when the --debug flag is passed at build time. When in debug mode provisioners will get wrapped by a DebuggedProvisioner and properly pause between provisioning steps.

~>  packer build --debug /tmp/source.pkr.hcl
Debug mode enabled. Builds will not be parallelized.
null.example: output will be in this color.

==> null.example: Pausing after run of step 'StepConnect'. Press enter to continue.
==> null.example: Pausing before the next provisioner . Press enter to continue.
==> null.example: Running local shell script: /var/folders/vz/rv7bk6v15211jxg8q801f7kw0000gq/T/packer-shell4149319610
    null.example: hi
==> null.example: Pausing before the next provisioner . Press enter to continue.
==> null.example: Running local shell script: /var/folders/vz/rv7bk6v15211jxg8q801f7kw0000gq/T/packer-shell3210691290
    null.example: hi 2
==> null.example: Pausing after run of step 'StepProvision'. Press enter to continue.
==> null.example: Pausing before cleanup of step 'StepProvision'. Press enter to continue.
==> null.example: Pausing before cleanup of step 'StepConnect'. Press enter to continue.
Build 'null.example' finished after 8 seconds 284 milliseconds.

==> Wait completed after 8 seconds 284 milliseconds

==> Builds finished. The artifacts of successful builds are:
--> null.example: Did not export anything. This is the null builder

Closes #11457

nywilken and others added 2 commits February 2, 2022 11:06
…ebug flag is passed

```
~>  packer build --debug /tmp/source.pkr.hcl
Debug mode enabled. Builds will not be parallelized.
null.example: output will be in this color.

==> null.example: Pausing after run of step 'StepConnect'. Press enter to continue.
==> null.example: Pausing before the next provisioner . Press enter to continue.
==> null.example: Running local shell script: /var/folders/vz/rv7bk6v15211jxg8q801f7kw0000gq/T/packer-shell4149319610
    null.example: hi
==> null.example: Pausing before the next provisioner . Press enter to continue.
==> null.example: Running local shell script: /var/folders/vz/rv7bk6v15211jxg8q801f7kw0000gq/T/packer-shell3210691290
    null.example: hi 2
==> null.example: Pausing after run of step 'StepProvision'. Press enter to continue.
==> null.example: Pausing before cleanup of step 'StepProvision'. Press enter to continue.
==> null.example: Pausing before cleanup of step 'StepConnect'. Press enter to continue.
Build 'null.example' finished after 8 seconds 284 milliseconds.

==> Wait completed after 8 seconds 284 milliseconds

==> Builds finished. The artifacts of successful builds are:
--> null.example: Did not export anything. This is the null builder
```
@nywilken nywilken force-pushed the wilken/fix-11457-provisioner-debug branch from 218360e to 768015c Compare February 2, 2022 16:09
@nywilken
Copy link
Member Author

nywilken commented Feb 2, 2022

I'm going to open up this PR for review. I validated locally and ask that the reviewer does the same. I will be opening a separate PR with testing for these command line flags.

@nywilken nywilken marked this pull request as ready for review February 2, 2022 16:09
@nywilken nywilken requested a review from a team as a code owner February 2, 2022 16:09
Comment on lines +613 to +615
pcb.SetDebug(cfg.debug)
pcb.SetForce(cfg.force)
pcb.SetOnError(cfg.onError)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup this should have been there !

Copy link
Contributor

@azr azr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice fix !

@nywilken nywilken merged commit 2ad1561 into master Feb 3, 2022
@nywilken nywilken deleted the wilken/fix-11457-provisioner-debug branch February 3, 2022 14:03
@github-actions
Copy link

github-actions bot commented Mar 6, 2022

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[1.7.x] -debug argument does not pause between provisioners
2 participants