Files
helmfile/pkg/helmexec/helmexec.go
T
yxxhero ec7302c9dc fix: enable kubedog tracking with atomic/rollback-on-failure helm flags
When using atomic: true with trackMode: kubedog, the --atomic flag was
passed to Helm which caused Helm to wait for resources and rollback
internally before helmfile could start kubedog tracking. This prevented
users from seeing deployment logs and errors.

Changes:
- Add RollbackRelease method to helmexec interface and implementation
- Add appendAtomicFlags function that skips --atomic when kubedog is enabled
- Add handleKubedogFailure function to manually rollback on tracking failure
- Update flagsForUpgrade to use new atomic flag handling
- Add tests for appendAtomicFlags behavior

Now when atomic: true and trackMode: kubedog are both enabled:
1. Helm upgrade runs without --atomic (no internal wait)
2. kubedog tracks resources immediately (users can see logs)
3. If kubedog tracking fails, helmfile manually executes rollback
4. Atomic semantics are preserved

Fixes: #2448
Signed-off-by: yxxhero <aiopsclub@163.com>
2026-03-25 08:37:26 +08:00

50 lines
1.9 KiB
Go

package helmexec
import chart "helm.sh/helm/v4/pkg/chart/v2"
// Version represents the version of helm
type Version struct {
Major int
Minor int
Patch int
}
// Interface for executing helm commands
type Interface interface {
SetExtraArgs(args ...string)
SetHelmBinary(bin string)
SetEnableLiveOutput(enableLiveOutput bool)
SetDisableForceUpdate(forceUpdate bool)
AddRepo(name, repository, cafile, certfile, keyfile, username, password string, managed string, passCredentials, skipTLSVerify bool) error
UpdateRepo() error
RegistryLogin(name, username, password, caFile, certFile, keyFile string, skipTLSVerify bool) error
BuildDeps(name, chart string, flags ...string) error
UpdateDeps(chart string) error
SyncRelease(context HelmContext, name, chart, namespace string, flags ...string) error
DiffRelease(context HelmContext, name, chart, namespace string, suppressDiff bool, flags ...string) error
TemplateRelease(name, chart string, flags ...string) error
Fetch(chart string, flags ...string) error
ChartPull(chart string, path string, flags ...string) error
ChartExport(chart string, path string) error
Lint(name, chart string, flags ...string) error
Unittest(name, chart string, flags ...string) error
ReleaseStatus(context HelmContext, name string, flags ...string) error
DeleteRelease(context HelmContext, name string, flags ...string) error
RollbackRelease(context HelmContext, name string, flags ...string) error
TestRelease(context HelmContext, name string, flags ...string) error
List(context HelmContext, filter string, flags ...string) (string, error)
DecryptSecret(context HelmContext, name string, flags ...string) (string, error)
IsHelm3() bool
IsHelm4() bool
GetVersion() Version
IsVersionAtLeast(versionStr string) bool
ShowChart(chart string) (chart.Metadata, error)
}
type DependencyUpdater interface {
UpdateDeps(chart string) error
IsHelm3() bool
IsHelm4() bool
}