Debugging Packer builds within a CI pipeline

52 views
Skip to first unread message

Adam Rush

unread,
May 5, 2020, 1:24:41 PM5/5/20
to Packer
I know we can use `-debug` and `-on-error=ask` when doing local Packer builds, but they don't seem to work within a CI build pipeline (like Jenkins).

Has anyone else found a solution for debugging within a CI pipeline?

Alvaro Miranda Aguilera

unread,
May 6, 2020, 2:23:00 PM5/6/20
to packe...@googlegroups.com
have you tried PACKER_LOG=DEBUG as environment variable ?


On Tue, May 5, 2020 at 7:24 PM Adam Rush <adamr...@gmail.com> wrote:
I know we can use `-debug` and `-on-error=ask` when doing local Packer builds, but they don't seem to work within a CI build pipeline (like Jenkins).

Has anyone else found a solution for debugging within a CI pipeline?

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/0920f84f-b662-4493-99d4-c306937ae6c0%40googlegroups.com.


--
Alvaro

Adam Rush

unread,
May 7, 2020, 10:43:22 AM5/7/20
to Packer
I tried that but no joy. I think that just enables the logging, and I already had `PACKER_LOG=1`.


On Wednesday, 6 May 2020 19:23:00 UTC+1, Alvaro Miranda Aguilera wrote:
have you tried PACKER_LOG=DEBUG as environment variable ?


On Tue, May 5, 2020 at 7:24 PM Adam Rush <adamr...@gmail.com> wrote:
I know we can use `-debug` and `-on-error=ask` when doing local Packer builds, but they don't seem to work within a CI build pipeline (like Jenkins).

Has anyone else found a solution for debugging within a CI pipeline?

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to packe...@googlegroups.com.


--
Alvaro

Lesley Kimmel

unread,
May 7, 2020, 10:50:08 AM5/7/20
to Packer
Can you describe more what you are trying to see and why you are unable to? I'm currently using Packer inside a CI pipeline. The pipeline itself usually gives me the Packer output at the end. I also found that, on the Packer server itself, Packer has a log (/tmp/packer-logXXXXXX) that contains all of it's normal CLI output. Packer logging is generally pretty clear on what any issues are.

Adam Rush

unread,
May 7, 2020, 10:57:17 AM5/7/20
to Packer
Sure. For some context, I'm running Packer via a Jenkins pipeline, which spins up an ephemeral container within a Kubernetes cluster.
As some builds can take an hour or more to run, I'd like Packer to pause when an error occurs, then I can attach to the container and start debugging the current environment.
This would greatly improve the dev process and make debugging much faster.

I believe this doesnt currently work as I thought as the container doesnt have a terminal attached, so I'm looking for possible solutions.

Megan Marsh

unread,
May 8, 2020, 12:36:43 PM5/8/20
to packe...@googlegroups.com
I'd suggest just setting --on-error=abort; that will make Packer exit without cleaning up the container so that you can get onto it and start debugging. 

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/ac67577c-7c3b-4c8e-875d-1991c7e987d2%40googlegroups.com.

Adam Rush

unread,
May 8, 2020, 12:45:33 PM5/8/20
to packe...@googlegroups.com
Thanks Megan. That’s got me closer, but it only leaves the VM. I want the build container to pause, so I can debug from there if possible?

You received this message because you are subscribed to a topic in the Google Groups "Packer" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/packer-tool/iizE3UkXMgo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to packer-tool...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/CAGPV1upTK2s-supCyM4%3DNCpQqnN8181UW4-nQd4dS4Ca7hgaHQ%40mail.gmail.com.

Megan Marsh

unread,
May 12, 2020, 4:20:51 PM5/12/20
to packe...@googlegroups.com
I don't think there's a way within packer to do that but if you write a little wrapping script to call Packer you can probably force the build container to pause too. 

Adam Rush

unread,
May 13, 2020, 2:05:03 AM5/13/20
to Packer
Ok thanks Megan. I thought that might be the case.
I'll keep investigating workarounds...I think I'm on to something!
Reply all
Reply to author
Forward
0 new messages