Expose internal apis (#2520)

* feat: expose WithPreparedCharts and SyncRun

This exposes the previously internal functions withPreparedCharts and
sync to be used by tooling built on top of helmfile

Co-authored-by: Raphael Luba <raphael@leanbyte.com>
Signed-off-by: Niklas Ott <niklas.ott@unwired.at>

* feat: expose Helm interface and HelmState

This adds a function to get the current HelmState

Co-authored-by: Raphael Luba <raphael@leanbyte.com>
Signed-off-by: Niklas Ott <niklas.ott@unwired.at>

* feat: return an error instead of panicking on multiple calls on WithPreparedCharts

Signed-off-by: Niklas Ott <niklas.ott@unwired.at>

---------

Signed-off-by: Niklas Ott <niklas.ott@unwired.at>
Co-authored-by: Raphael Luba <raphael@leanbyte.com>
This commit is contained in:
Niklas
2026-05-07 21:52:18 +08:00
committed by GitHub
co-authored by Raphael Luba
parent 0139304d97
commit 897400d64f
2 changed files with 26 additions and 18 deletions
+10 -2
View File
@@ -57,9 +57,9 @@ func (r *Run) prepareChartsIfNeeded(helmfileCommand string, dir string, concurre
return releaseToChart, nil
}
func (r *Run) withPreparedCharts(helmfileCommand string, opts state.ChartPrepareOptions, f func() []error) error {
func (r *Run) WithPreparedCharts(helmfileCommand string, opts state.ChartPrepareOptions, f func() []error) error {
if r.ReleaseToChart != nil {
panic("Run.PrepareCharts can be called only once")
return fmt.Errorf("Run.WithPreparedCharts can be called only once")
}
// Check both CLI options and helmDefaults for skipping repos (issue #2296)
@@ -238,3 +238,11 @@ func (r *Run) diff(triggerCleanupEvent bool, detailedExitCode bool, c DiffConfig
return &infoMsg, releasesToBeUpdated, releasesToBeDeleted, nil
}
func (r *Run) State() *state.HelmState {
return r.state
}
func (r *Run) Helm() helmexec.Interface {
return r.helm
}