|
|
@@ -20,6 +20,7 @@ import (
|
|
|
"bytes"
|
|
|
"fmt"
|
|
|
"os"
|
|
|
+ "os/exec"
|
|
|
"path/filepath"
|
|
|
"strings"
|
|
|
|
|
|
@@ -28,7 +29,6 @@ import (
|
|
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
|
|
|
|
"github.com/external-secrets/external-secrets-e2e/framework/log"
|
|
|
- frameworkutil "github.com/external-secrets/external-secrets-e2e/framework/util"
|
|
|
)
|
|
|
|
|
|
// HelmChart installs the specified Chart into the cluster.
|
|
|
@@ -69,10 +69,7 @@ func (c *HelmChart) Install() error {
|
|
|
"dependency", "update", filepath.Join(AssetDir(), "deploy/charts/external-secrets"),
|
|
|
}
|
|
|
log.Logf("updating chart dependencies with args: %+q", args)
|
|
|
- cmd, err := frameworkutil.Command("helm", args...)
|
|
|
- if err != nil {
|
|
|
- return fmt.Errorf("resolve helm executable: %w", err)
|
|
|
- }
|
|
|
+ cmd := exec.Command("helm", args...)
|
|
|
output, err := cmd.CombinedOutput()
|
|
|
if err != nil {
|
|
|
return fmt.Errorf("unable to run update cmd: %w: %s", err, string(output))
|
|
|
@@ -154,18 +151,12 @@ func (c *HelmChart) releaseStatusArgs() []string {
|
|
|
|
|
|
func (c *HelmChart) runInstall(args []string) ([]byte, error) {
|
|
|
log.Logf("installing chart with args: %+q", args)
|
|
|
- cmd, err := frameworkutil.Command("helm", args...)
|
|
|
- if err != nil {
|
|
|
- return nil, fmt.Errorf("resolve helm executable: %w", err)
|
|
|
- }
|
|
|
+ cmd := exec.Command("helm", args...)
|
|
|
return cmd.CombinedOutput()
|
|
|
}
|
|
|
|
|
|
func (c *HelmChart) cleanupExistingRelease() error {
|
|
|
- cmd, err := frameworkutil.Command("helm", c.cleanupUninstallArgs()...)
|
|
|
- if err != nil {
|
|
|
- return fmt.Errorf("resolve helm executable: %w", err)
|
|
|
- }
|
|
|
+ cmd := exec.Command("helm", c.cleanupUninstallArgs()...)
|
|
|
output, err := cmd.CombinedOutput()
|
|
|
if err != nil && !strings.Contains(string(output), "release: not found") {
|
|
|
statusOutput, statusErr := c.releaseStatus()
|
|
|
@@ -181,10 +172,7 @@ func (c *HelmChart) cleanupExistingRelease() error {
|
|
|
}
|
|
|
|
|
|
func (c *HelmChart) releaseStatus() ([]byte, error) {
|
|
|
- cmd, err := frameworkutil.Command("helm", c.releaseStatusArgs()...)
|
|
|
- if err != nil {
|
|
|
- return nil, fmt.Errorf("resolve helm executable: %w", err)
|
|
|
- }
|
|
|
+ cmd := exec.Command("helm", c.releaseStatusArgs()...)
|
|
|
return cmd.CombinedOutput()
|
|
|
}
|
|
|
|
|
|
@@ -202,10 +190,7 @@ func canIgnoreHelmCleanupError(statusOutput string) bool {
|
|
|
|
|
|
// Uninstall removes the chart aswell as the repo.
|
|
|
func (c *HelmChart) Uninstall() error {
|
|
|
- cmd, err := frameworkutil.Command("helm", c.uninstallArgs()...)
|
|
|
- if err != nil {
|
|
|
- return fmt.Errorf("resolve helm executable: %w", err)
|
|
|
- }
|
|
|
+ cmd := exec.Command("helm", c.uninstallArgs()...)
|
|
|
output, err := cmd.CombinedOutput()
|
|
|
if err != nil {
|
|
|
return fmt.Errorf("unable to uninstall helm release: %w: %s", err, string(output))
|
|
|
@@ -219,13 +204,10 @@ func (c *HelmChart) addRepo() error {
|
|
|
}
|
|
|
var sout, serr bytes.Buffer
|
|
|
args := []string{"repo", "add", c.Repo.Name, c.Repo.URL}
|
|
|
- cmd, err := frameworkutil.Command("helm", args...)
|
|
|
- if err != nil {
|
|
|
- return fmt.Errorf("resolve helm executable: %w", err)
|
|
|
- }
|
|
|
+ cmd := exec.Command("helm", args...)
|
|
|
cmd.Stdout = &sout
|
|
|
cmd.Stderr = &serr
|
|
|
- err = cmd.Run()
|
|
|
+ err := cmd.Run()
|
|
|
if err != nil {
|
|
|
return fmt.Errorf("unable to add helm repo: %w: %s, %s", err, sout.String(), serr.String())
|
|
|
}
|
|
|
@@ -238,10 +220,7 @@ func (c *HelmChart) removeRepo() error {
|
|
|
}
|
|
|
|
|
|
args := []string{"repo", "remove", c.Repo.Name}
|
|
|
- cmd, err := frameworkutil.Command("helm", args...)
|
|
|
- if err != nil {
|
|
|
- return fmt.Errorf("resolve helm executable: %w", err)
|
|
|
- }
|
|
|
+ cmd := exec.Command("helm", args...)
|
|
|
output, err := cmd.CombinedOutput()
|
|
|
if err != nil {
|
|
|
return fmt.Errorf("unable to remove repo: %w: %s", err, string(output))
|