Hi Andrew, Glad to hear our tools are working out for you.
We don't allow you to pass an entire varfile in from the command line, but you can use -var to pass each variable. For example, you could generate a long list of `-var 'x=y' -var 'a=b'` etc and pass that in. Hopefully that works for you. --Matt On Wed, May 17, 2017 at 1:44 PM <[email protected]> wrote: > I've been using Packer in the context of a Jenkinsfile (using the Pipeline > plugin for Jenkins) with success. The only problem is the need to write a > JSON file to the local file system that can be passed to Packer. > > Is there any sort of functionality that would allow me to execute Packer > from a script, and pass a "JSON file", but via memory instead of a local > file? > > To put more context to the question, in the Jenkinsfile, the call > currently looks something like this: > > sh "packer build -var-file=variables.json packer.json" > > ...where the script is executing Packer via shell and is reading a local > file that contains the JSON variables. > > What I would like to be able to do is along the lines of: > > def json_var = unimportant_function_that_generates_json() > sh "packer build -var-file=${json_var} packer.json" > > ...where a variable is created in the script containing JSON, and the > shell call to packer can be passed the variable. > > Is anything like this possible? If not, are there any plans in the future > to implement a feature similar to this? > > Once again we're huge fans of Hashicorp's open source products here at > AOL, keep up the good work!!! > > Andrew > > -- > 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 [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/packer-tool/0e6eb23e-5e79-46b7-9521-7919b03ba586%40googlegroups.com > <https://groups.google.com/d/msgid/packer-tool/0e6eb23e-5e79-46b7-9521-7919b03ba586%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/CAEpfdnz_d%2B0XyosP9k3fY6KejfyS7Y91HL8KrR4nBrg8P-Ld7w%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
