fix more issue

Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
yxxhero
2024-06-02 15:03:54 +08:00
parent cc3202e9b9
commit 61b4199c80
12 changed files with 64 additions and 25 deletions
+4 -2
View File
@@ -1424,6 +1424,7 @@ func (a *App) apply(r *Run, c ApplyConfigProvider) (bool, bool, []error) {
PostRenderer: c.PostRenderer(),
PostRendererArgs: c.PostRendererArgs(),
SuppressOutputLineRegex: c.SuppressOutputLineRegex(),
DryRun: c.DryRun("diff"),
}
infoMsg, releasesToBeUpdated, releasesToBeDeleted, errs := r.diff(false, detailedExitCode, c, diffOpts)
@@ -1536,7 +1537,7 @@ Do you really want to apply?
PostRenderer: c.PostRenderer(),
PostRendererArgs: c.PostRendererArgs(),
SyncArgs: c.SyncArgs(),
DryRun: c.DryRun(),
DryRun: c.DryRun("sync"),
}
return subst.SyncReleases(&affectedReleases, helm, c.Values(), c.Concurrency(), syncOpts)
}))
@@ -1663,6 +1664,7 @@ func (a *App) diff(r *Run, c DiffConfigProvider) (*string, bool, bool, []error)
PostRenderer: c.PostRenderer(),
PostRendererArgs: c.PostRendererArgs(),
SuppressOutputLineRegex: c.SuppressOutputLineRegex(),
DryRun: c.DryRun("diff"),
}
filtered := &Run{
@@ -1930,7 +1932,7 @@ Do you really want to sync?
PostRenderer: c.PostRenderer(),
PostRendererArgs: c.PostRendererArgs(),
SyncArgs: c.SyncArgs(),
DryRun: c.DryRun(),
DryRun: c.DryRun("sync"),
}
return subst.SyncReleases(&affectedReleases, helm, c.Values(), c.Concurrency(), opts)
}))
+14 -6
View File
@@ -2194,10 +2194,11 @@ func (c configImpl) ShowOnly() []string {
}
type applyConfig struct {
args string
cascade string
dryRun string
values []string
args string
cascade string
diffDryRun string
syncDryRun string
values []string
// TODO: Remove this function once Helmfile v0.x
retainValuesFiles bool
@@ -2416,8 +2417,15 @@ func (a applyConfig) ShowOnly() []string {
return a.showOnly
}
func (a applyConfig) DryRun() string {
return a.dryRun
func (a applyConfig) DryRun(stage string) string {
switch stage {
case "diff":
return a.diffDryRun
case "sync":
return a.syncDryRun
default:
return ""
}
}
type depsConfig struct {
+3 -2
View File
@@ -52,7 +52,7 @@ type ApplyConfigProvider interface {
PostRendererArgs() []string
Cascade() string
SuppressOutputLineRegex() []string
DryRun() string
DryRun(string) string
Values() []string
Set() []string
@@ -100,7 +100,7 @@ type SyncConfigProvider interface {
PostRenderer() string
PostRendererArgs() []string
Cascade() string
DryRun() string
DryRun(string) string
Values() []string
Set() []string
@@ -134,6 +134,7 @@ type DiffConfigProvider interface {
Validate() bool
SkipCRDs() bool
SkipDeps() bool
DryRun(string) string
IncludeTests() bool
+4
View File
@@ -44,6 +44,7 @@ type diffConfig struct {
skipDiffOnInstall bool
reuseValues bool
logger *zap.SugaredLogger
dryRun string
}
func (a diffConfig) Args() string {
@@ -174,6 +175,9 @@ func (a diffConfig) SuppressOutputLineRegex() []string {
return a.suppressOutputLineRegex
}
func (a diffConfig) DryRun(string) string {
return a.dryRun
}
func TestDiff(t *testing.T) {
type flags struct {
skipNeeds bool