command: plugins install reject non-releases

When installing a plugin with packer plugins install --path, we only
accept release versions of a plugin, as otherwise the loading can be
inconsistent if for example a user specifies a required_plugins block in
their template, in which case the plugins will be ignored.

Until we have a simpler loading scheme then, we will reject non-release
versions of plugins to avoid confusion.
pull/12736/head
Lucas Bajolet 3 years ago committed by Lucas Bajolet
parent ae5b91864c
commit e293f2d890

@ -263,6 +263,14 @@ an issue on our Github repo to signal it.`)
}})
}
if strings.Contains(desc.Version, "-") {
return writeDiags(c.Ui, nil, hcl.Diagnostics{&hcl.Diagnostic{
Severity: hcl.DiagError,
Summary: "Invalid version",
Detail: fmt.Sprintf("Packer can only install plugin releases with this command (ex: 1.0.0), the binary's reported version is %q", desc.Version),
}})
}
pluginBinary, err := os.Open(args.PluginPath)
if err != nil {
return writeDiags(c.Ui, nil, hcl.Diagnostics{&hcl.Diagnostic{

Loading…
Cancel
Save