From 6d0d5c89f36f054ba34d5d38321c29a60aed4134 Mon Sep 17 00:00:00 2001 From: Wilken Rivera Date: Tue, 7 Sep 2021 16:14:59 -0400 Subject: [PATCH] Update plugin directory check for ci (#11253) * Update plugin directory check for ci On CIRCLECI the default plugin direction is under `$HOME/.config/packer` this changes updates the acctest just a bit to check if we are running in a CIRCLECI env. * Apply same logic to cleanup step --- acctest/plugin/plugin_acc_test.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/acctest/plugin/plugin_acc_test.go b/acctest/plugin/plugin_acc_test.go index ed5ee55e7..b1d1f7d20 100644 --- a/acctest/plugin/plugin_acc_test.go +++ b/acctest/plugin/plugin_acc_test.go @@ -85,6 +85,17 @@ func cleanupPluginInstallation(plugin addrs.Plugin) error { plugin.Hostname, plugin.Namespace, plugin.Type) + + if _, ok := os.LookupEnv("CIRCLECI"); ok { + pluginPath = filepath.Join(home, + ".config", + "packer", + "plugins", + plugin.Hostname, + plugin.Namespace, + plugin.Type) + } + testutils.CleanupFiles(pluginPath) return nil } @@ -99,12 +110,24 @@ func checkPluginInstallation(initOutput string, plugin addrs.Plugin) error { if err != nil { return err } + pluginPath := filepath.Join(home, ".packer.d", "plugins", plugin.Hostname, plugin.Namespace, plugin.Type) + + if _, ok := os.LookupEnv("CIRCLECI"); ok { + pluginPath = filepath.Join(home, + ".config", + "packer", + "plugins", + plugin.Hostname, + plugin.Namespace, + plugin.Type) + } + if !testutils.FileExists(pluginPath) { return fmt.Errorf("%s plugin installation not found", plugin.String()) }