feat(diff,apply): --context=N for limiting diff context (#849)

Resolves #787
This commit is contained in:
KUOKA Yusuke
2019-09-12 18:36:13 +09:00
committed by GitHub
parent fb2041555e
commit 94a6fcfb9f
5 changed files with 25 additions and 0 deletions
+2
View File
@@ -41,6 +41,7 @@ type ApplyConfigProvider interface {
SuppressSecrets() bool
NoColor() bool
Context() int
concurrencyConfig
interactive
@@ -67,6 +68,7 @@ type DiffConfigProvider interface {
DetailedExitcode() bool
NoColor() bool
Context() int
concurrencyConfig
}
+1
View File
@@ -139,6 +139,7 @@ func (r *Run) Apply(c ApplyConfigProvider) []error {
diffOpts := &state.DiffOpts{
NoColor: c.NoColor(),
Context: c.Context(),
}
releases, errs := st.DiffReleases(helm, c.Values(), c.Concurrency(), detailedExitCode, c.SuppressSecrets(), false, diffOpts)
+5
View File
@@ -776,6 +776,10 @@ func (st *HelmState) prepareDiffReleases(helm helmexec.Interface, additionalValu
flags = append(flags, "--no-color")
}
if opts.Context > 0 {
flags = append(flags, "--context", fmt.Sprintf("%d", opts.Context))
}
if len(errs) > 0 {
rsErrs := make([]*ReleaseError, len(errs))
for i, e := range errs {
@@ -823,6 +827,7 @@ func (st *HelmState) createHelmContext(spec *ReleaseSpec, workerIndex int) helme
type DiffOpts struct {
NoColor bool
Context int
}
func (o *DiffOpts) Apply(opts *DiffOpts) {