Fix path to plugins 99/3799/1
authorjcope <jcope@redhat.com>
Mon, 19 Oct 2020 15:30:48 +0000 (10:30 -0500)
committerjcope <jcope@redhat.com>
Mon, 19 Oct 2020 15:30:48 +0000 (10:30 -0500)
https://gerrit.akraino.org/r/c/kni/installer/+/3790 set the build
artifacts to be written to ./bin, which broke the relative path set in
ApplyKustomize to the kustomize plugins.  This patch adjusts the
relative path appropriately.

Signed-off-by: jcope <jcope@redhat.com>
Change-Id: Ic55f97baf7a95a48f09053a1a1c12d9e0d3e08d9

pkg/utils/utils.go

index cdf85ed..f927e8d 100644 (file)
@@ -42,9 +42,12 @@ func ApplyKustomize(kustomizeBinary string, kustomizePath string) []byte {
        if err != nil {
                log.Fatal("Error retrieving the current running path")
        }
-       exPath := filepath.Dir(ex)
-
-       envVars := []string{fmt.Sprintf("XDG_CONFIG_HOME=%s/plugins", exPath)}
+       pluginPath := filepath.Dir(ex)
+       pluginPath, err = filepath.Abs(filepath.Join(pluginPath, "../plugins"))
+       if err != nil {
+               log.Fatalf("failed get plugin path: %v", err)
+       }
+       envVars := []string{fmt.Sprintf("XDG_CONFIG_HOME=%s", pluginPath)}
        out, _ := ExecuteCommand("", envVars, true, false, kustomizeBinary, "build", "--enable_alpha_plugins", "--reorder", "none", kustomizePath)
 
        return out