From 4d4d207e72fc396c0ad46eaf167f31ab79ffe745 Mon Sep 17 00:00:00 2001 From: Lucas Bajolet Date: Fri, 15 Mar 2024 10:29:28 -0400 Subject: [PATCH] cmd/plugin_install: use semver to render version When installing a plugin from a local binary, Packer builds the name of the plugin from the results of the `describe' command. Depending on how the plugin is built, the version reported may or may not contain a leading `v', which was not taken into account beforehand and the leading `v' was always injected in the path. This caused plugins that report a leading `v' in their version to be installed with two v's in their path, making them impossible to load. Therefore to fix this issue, we count on the version library to print out a version without the leading v, and we inject that in the resulting path. --- command/plugins_install.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/command/plugins_install.go b/command/plugins_install.go index 0540909c480..a2711e4ec46 100644 --- a/command/plugins_install.go +++ b/command/plugins_install.go @@ -303,7 +303,7 @@ func (c *PluginsInstallCommand) InstallFromBinary(opts plugingetter.ListInstalla outputPrefix := fmt.Sprintf( "packer-plugin-%s_v%s_%s", pluginIdentifier.Type, - desc.Version, + semver.String(), desc.APIVersion, ) binaryPath := filepath.Join(