Enable helmfile-diff to pass the output format to helm-diff (#1784)

* tests: fix vagrant test run

* feat: added an option to specify the different diff output format

* renamed diff-output to output

* renamed diff-output to output

Co-authored-by: Andrey Tuzhilin <andrey@zelf.co>
This commit is contained in:
astorath
2021-04-24 08:07:24 +09:00
committed by GitHub
co-authored by Andrey Tuzhilin
parent 28ade19419
commit 83189dbad3
9 changed files with 40 additions and 3 deletions
+2
View File
@@ -1153,6 +1153,7 @@ func (a *App) apply(r *Run, c ApplyConfigProvider) (bool, bool, []error) {
diffOpts := &state.DiffOpts{
NoColor: c.NoColor(),
Context: c.Context(),
Output: c.DiffOutput(),
Set: c.Set(),
SkipCleanup: c.RetainValuesFiles() || c.SkipCleanup(),
SkipDiffOnInstall: c.SkipDiffOnInstall(),
@@ -1378,6 +1379,7 @@ func (a *App) diff(r *Run, c DiffConfigProvider) (*string, bool, bool, []error)
opts := &state.DiffOpts{
Context: c.Context(),
Output: c.DiffOutput(),
NoColor: c.NoColor(),
Set: c.Set(),
}
+5
View File
@@ -2331,6 +2331,7 @@ type applyConfig struct {
suppressDiff bool
noColor bool
context int
diffOutput string
concurrency int
detailedExitcode bool
interactive bool
@@ -2408,6 +2409,10 @@ func (a applyConfig) Context() int {
return a.context
}
func (a applyConfig) DiffOutput() string {
return a.diffOutput
}
func (a applyConfig) Concurrency() int {
return a.concurrency
}
+2
View File
@@ -54,6 +54,7 @@ type ApplyConfigProvider interface {
NoColor() bool
Context() int
DiffOutput() string
RetainValuesFiles() bool
SkipCleanup() bool
@@ -104,6 +105,7 @@ type DiffConfigProvider interface {
DetailedExitcode() bool
NoColor() bool
Context() int
DiffOutput() string
concurrencyConfig
}
+5
View File
@@ -32,6 +32,7 @@ type diffConfig struct {
suppressDiff bool
noColor bool
context int
diffOutput string
concurrency int
detailedExitcode bool
interactive bool
@@ -94,6 +95,10 @@ func (a diffConfig) Context() int {
return a.context
}
func (a diffConfig) DiffOutput() string {
return a.diffOutput
}
func (a diffConfig) Concurrency() int {
return a.concurrency
}
+5
View File
@@ -1664,6 +1664,10 @@ func (st *HelmState) prepareDiffReleases(helm helmexec.Interface, additionalValu
flags = append(flags, "--context", fmt.Sprintf("%d", opts.Context))
}
if opts.Output != "" {
flags = append(flags, "--output", fmt.Sprintf("%s", opts.Output))
}
if opts.Set != nil {
for _, s := range opts.Set {
flags = append(flags, "--set", s)
@@ -1739,6 +1743,7 @@ func (st *HelmState) createHelmContextWithWriter(spec *ReleaseSpec, w io.Writer)
type DiffOpts struct {
Context int
Output string
NoColor bool
Set []string