Skip to content

Commit 68ede7a

Browse files
committed
run helm debug per default and hide stdout to hide yaml output
1 parent 6d1849d commit 68ede7a

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

internal/helm/helm.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,15 @@ func WithDryRun(dry bool) HelmOption {
118118
}
119119
}
120120

121+
func WithDebug(dry bool) HelmOption {
122+
return func(c *HelmCmd) error {
123+
if dry {
124+
c.Args = append(c.Args, "--debug")
125+
}
126+
return nil
127+
}
128+
}
129+
121130
func WithTimeout(timeout time.Duration) HelmOption {
122131
return func(c *HelmCmd) error {
123132
c.Args = append(c.Args, "--timeout", timeout.String())

main.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,13 @@ type (
3232
Release string `envconfig:"RELEASE" required:"true"` // helm release name
3333
Namespace string `envconfig:"NAMESPACE" required:"true"` // kubernets and helm namespace
3434

35-
Lint bool `envconfig:"LINT" default:"true"` // helm lint option
36-
Atomic bool `envconfig:"ATOMIC" default:"true"` // helm atomic option
37-
Wait bool `envconfig:"WAIT" default:"true"` // helm wait option
38-
Force bool `envconfig:"FORCE" default:"false"` // helm force option
39-
Cleanup bool `envconfig:"CLEANUP_ON_FAIL" default:"false"` // helm cleanup option
40-
DryRun bool `envconfig:"DRY_RUN" default:"false"` // helm dryrun option
35+
Lint bool `envconfig:"LINT" default:"true"` // helm lint option
36+
Atomic bool `envconfig:"ATOMIC" default:"true"` // helm atomic option
37+
Wait bool `envconfig:"WAIT" default:"true"` // helm wait option
38+
Force bool `envconfig:"FORCE" default:"false"` // helm force option
39+
Cleanup bool `envconfig:"CLEANUP_ON_FAIL" default:"false"` // helm cleanup option
40+
DryRun bool `envconfig:"DRY_RUN" default:"false"` // helm dryrun option
41+
HelmDebug bool `envconfig:"HELM_DEBUG" default:"true"` // helm debug option
4142

4243
HelmRepos []string `envconfig:"HELM_REPOS"` // additonal helm repos
4344
BuildDependencies bool `envconfig:"BUILD_DEPENDENCIES" default:"true"` // helm dependency build option
@@ -155,6 +156,7 @@ func main() {
155156
helm.WithForce(cfg.Force),
156157
helm.WithCleanupOnFail(cfg.Cleanup),
157158
helm.WithDryRun(cfg.DryRun),
159+
helm.WithDebug(cfg.HelmDebug),
158160

159161
helm.WithHelmRepos(cfg.HelmRepos),
160162
helm.WithBuildDependencies(cfg.BuildDependencies, cfg.Chart),
@@ -201,7 +203,6 @@ func (r *Runner) Run(ctx context.Context, name string, args ...string) error {
201203
log.Printf("running: %s %v", name, printArgs)
202204

203205
cmd := exec.CommandContext(ctx, name, args...)
204-
cmd.Stdout = os.Stdout
205206
cmd.Stderr = os.Stderr
206207
defer os.Stdout.Sync()
207208
defer os.Stderr.Sync()

0 commit comments

Comments
 (0)