Packer: Ability to install plugins outside of cwd, plugin directory, or packer directory

Created on 19 Aug 2017  ยท  8Comments  ยท  Source: hashicorp/packer

currently packer searches for plugins inside a user ~/.packer.d/plugins or at the same directory has the packer binary; this makes it impossible for having my chocolatey package available to all users. to make my scenario possible, packer would need to implement one of the following:

  1. search for plugins in PATH
  2. have a PACKER_PLUGINS_PATH which contains a list of possible plugin search paths

what do you think? which one should be implemented?

PS please note that installing the plugin binary in the same directory has packer is out of question, because chocolatey installs each package in its own directory, which means I would have to install my plugin inside other package directory, which is a no-no.

core enhancement

Most helpful comment

Would be really nice to be able to inform the -plugin-dir=<PATH> as we can do when using terraform init.
A good use case is, for example, a Pipeline where the packer binary is installed in WORKSPACE, it allows to use different versions of Packer so the ability to create the plugin dir in the WORKSPACE and inform packer where to looking for the plugins would be very interesting, especially for custom plugins.

All 8 comments

forgive me, I'm a bit ignorant on windows development. Could you install a symlink (shortcut?) in ~/.packer.d/plugins?

As for the way this should be done, see how terraform does it here: https://www.terraform.io/docs/plugins/basics.html#installing-a-plugin - by adding a line to the config (~/.packer.d/packer.config).

I think it'll be difficult to make a change that diverges from that.

You'll want to look at config.go, which is also where config from the config file should be available

Packer also has something like that, but that is not what I'm looking for, because one still has to do that for all users (existing and new).

I just put a packer plugin in /usr/local/bin/ and it found it. Not sure if that's a recent addition or not, but it most likely means this bug can be closed.

Hmm....that might have been because packer was in /usr/local/bin. Could you do that? Just put it all in /usr/local/bin?

Would be really nice to be able to inform the -plugin-dir=<PATH> as we can do when using terraform init.
A good use case is, for example, a Pipeline where the packer binary is installed in WORKSPACE, it allows to use different versions of Packer so the ability to create the plugin dir in the WORKSPACE and inform packer where to looking for the plugins would be very interesting, especially for custom plugins.

plugin dir variable would be super useful.

Jenkins volume mounts over jenkins user home dir, which then removes any plugins I've installed to my container image.

@stobias123 This currently exists -- it's the env var PACKER_CONFIG_DIR. You still need a .plugins.d/plugins subdirectory structure, but you can store the PACKER_CONFIG_DIR anywhere you want. For example:

export PACKER_CONFIG_DIR=/path/to/custom-dir-name
where the full path to your plugin packer-provisioner-custom is /path/to/custom-dir-name/.packer.d/plugins/packer-provisioner-custom

I'm going to lock this issue 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 similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Nikoos picture Nikoos  ยท  3Comments

tleyden picture tleyden  ยท  3Comments

mushon4 picture mushon4  ยท  3Comments

Tensho picture Tensho  ยท  3Comments

shashanksinha89 picture shashanksinha89  ยท  3Comments