Skip to content

Commit

Permalink
cmd/plugin_install: use semver to render version
Browse files Browse the repository at this point in the history
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 don't add that leading v to the path,
and instead rely on the version library to write it only once,
regardless of whether it was in the original string or not.
  • Loading branch information
lbajolet-hashicorp committed Mar 15, 2024
1 parent 6852381 commit da72caf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion command/plugins_install.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit da72caf

Please sign in to comment.