packer build returns 0 code on failure

580 views
Skip to first unread message

Dave Randall

unread,
Sep 29, 2017, 9:00:11 AM9/29/17
to Packer
I'm running packer on a Windows Server box and invoking it with PowerShell. I want the script itself to throw an error if the packer build fails. However, when I get packer build to fail on purpose (e.g. by supplying incorrect AWS access keys) it still returns a 0 exit code as if it completed successfully.

Is there any way to get packer to return a non-zero exit code on failure?

I've reviewed the documentation but to no avail. The closest thing was to add a -on-error=abort option, but that didn't make an impact.

Cheers,

Dave

Alvaro Miranda Aguilera

unread,
Sep 29, 2017, 9:02:34 AM9/29/17
to packe...@googlegroups.com
can you print the exit code as soon as packer finish?

in bash is echo $?

in cmd i think is echo %exitcode% or someting

From what I have seen i think in powershell you need to evaluate the exit code and make a break/exit if you want that due a non-zero exit code.

Alvaro

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/df8169aa-c99c-445c-b69e-ef1c07a919ed%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Alvaro

Reply all
Reply to author
Forward
0 new messages