From 525b0a7c4cff4635da6c971abb7fdd101ea81aa2 Mon Sep 17 00:00:00 2001 From: Lucas Bajolet Date: Fri, 23 Feb 2024 17:16:09 -0500 Subject: [PATCH] plugin: use API version for loading plugins While migrating to a unified approach for loading plugins, the API major and minor versions were not added to the constraints for discovering plugins from the environment, leading to Packer potentially considering plugins that are not compatible with itself. This should not be possible, but was due to this omission, which we fix with this commit. --- packer/plugin.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packer/plugin.go b/packer/plugin.go index d2bf0e200..30261d7e0 100644 --- a/packer/plugin.go +++ b/packer/plugin.go @@ -77,8 +77,10 @@ func (c *PluginConfig) Discover() error { installations, err := plugingetter.Requirement{}.ListInstallations(plugingetter.ListInstallationsOptions{ PluginDirectory: c.PluginDirectory, BinaryInstallationOptions: plugingetter.BinaryInstallationOptions{ - OS: runtime.GOOS, - ARCH: runtime.GOARCH, + OS: runtime.GOOS, + ARCH: runtime.GOARCH, + APIVersionMajor: pluginsdk.APIVersionMajor, + APIVersionMinor: pluginsdk.APIVersionMinor, Checksummers: []plugingetter.Checksummer{ {Type: "sha256", Hash: sha256.New()}, },