Skip to content

Commit

Permalink
Run helm repo update before searching repos (#1026)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimKev2 authored May 14, 2024
1 parent ee6fe0b commit 723c9bb
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pkg/helm/helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,18 @@ func (e ExecHelm) SearchRepo(chart, currVersion string, opts Opts) (ChartSearchV
}
defer os.Remove(repoFile)

// Helm repo update in order to let "helm search repo" function
updateCmd := e.cmd("repo", "update",
"--repository-config", repoFile,
)
var updateErrBuf bytes.Buffer
var updateOutBuf bytes.Buffer
updateCmd.Stderr = &updateErrBuf
updateCmd.Stdout = &updateOutBuf
if err := updateCmd.Run(); err != nil {
return nil, fmt.Errorf("%s\n%s", updateErrBuf.String(), err)
}

var chartVersions ChartSearchVersions
for _, versionRegex := range searchVersions {
var chartVersion ChartSearchVersions
Expand Down

0 comments on commit 723c9bb

Please sign in to comment.