hashicorp / packer-sdk-migrator

cli tool to help plugin maintainers update from packer v1.5.0 style plugins to packer style v1.7.0 plugins
Mozilla Public License 2.0
4 stars 3 forks source link

Migrator tool default packer-plugin-sdk version isn't compatible with packer 1.7 #2

Open frightenedmonkey opened 3 years ago

frightenedmonkey commented 3 years ago

The migrator tool to upgrade single component plugins generally seems to work well. However, it appears that the default version of the SDK that is used errors when used with packer 1.7 due to an assumption in the packer codebase when checking the protocol used by the plugin.

To set the context of the problem, packer 1.7 doesn't actually evaluate the version of the protocol sent by the plugin. That, arguably, is the bug, but I'm reporting it here because it's more easily solvable here. Here is where packer is evaluating the plugin protocol version, only checking whether the parts in the plugin server response is 3 parts because:

In protocol version 4 and before, the protocol only had a Major version

The version of the plugin SDK migrated to is v0.0.10, which, as you can see here, only sets the major version (albeit to major version 5).

However, in v0.0.11, the server sets both a major and minor version of the API.

I've verified in a plugin that I'm mucking about with that bumping the go.mod dependency to v0.0.11 works to get past the protocol error from packer. At the least, I think the migrator should bump the sdk dependency to v0.0.11. Cross-project version dependencies seem like they'd be difficult here, though.

frightenedmonkey commented 3 years ago

I'm happy to offer up a PR for the dependency bump, but I dunno if there are any unintended consequences of the simple version bump.