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
Implemented internal plugins #2608
Conversation
- Internal plugins are compiled into the same packer binary and invoked through the plugin command - Search paths allow disk-based plugins to override and should function as normal - This should allow for a 94% space savings vs statically compiling all the plugins as separate binaries.. approximately 24mb vs 431mb
Thanks @cbednarski this is a huge saving for smaller laptops lots of which sit around the 128GB mark. Hope to test this tomorrow. Build works fine, I needed to
|
Does it possible to add tags to not build some commands? |
|
||
server, err := plugin.Server() | ||
if err != nil { | ||
panic(err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we c.UI.Error and exit 1 here instead of panicicing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can add some more friendly error messaging but users can't call the plugin on their own. Currently if a user tries to run a plugin packer crashes and says "don't do that". This essentially preserves the existing behavior.
@vtolstov With the one-file-per-plugin approach it is feasible to use a flag to build selectively. With this new approach I think it is actually more complicated. Since you only need to build one file for packer which includes all the plugins, it's actually very fast and small even with all the plugins, so I don't think it's very important to provide a flag now. Also, custom plugins should still work the same as before. I still need to update the build and release tooling but for now you can use |
@cbednarski in case of using artifice post processor i get error:
|
@cbednarski please check pluginType in case of post (i'm write info below) |
… because of the post-processor case
@vtolstov I switched the implementation to use a regexp instead of string split. This implementation should be correct and also less code / easier to maintain. I tested with artifice and it works. Let me know if you still have any problems with it! |
@cbednarski may be instead of using if/else if use switch/case statement? |
@vtolstov Great feedback! Python habits. ;) |
LGTM for me, using all the day and not see any issues with this pr. |
Only thing: take a look at this to "hide" certain commands from the help: https://github.com/mitchellh/cli/blob/8102d0ed5ea2709ade1243798785888175f6e415/help.go#L63 We use it in Vault I think. But I think we should do that here to hide it from |
@mitchellh Nice! I was trying to figure out how to do that. |
Added generator for command/plugin.go
This was rebased and merged via #2854 |
It made input handling by |
Input handling in built-in plugins breaks because they call |
go get github.com/mitchellh/packer
work out of the box, without the need formake
The build scripts are not updated to use this and there is a name collision with the packer folder, so for the time being you can build this with: