Skip to content

Commit 556337a

Browse files
MattKetmomumoshu
authored andcommitted
feat: Add option to disable hooks in diff upgrade (#118)
1 parent d0f6065 commit 556337a

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

cmd/upgrade.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ type diffCmd struct {
2828
reuseValues bool
2929
resetValues bool
3030
allowUnreleased bool
31+
noHooks bool
3132
suppressedKinds []string
3233
outputContext int
3334
}
@@ -82,6 +83,7 @@ func newChartCommand() *cobra.Command {
8283
f.BoolVar(&diff.reuseValues, "reuse-values", false, "reuse the last release's values and merge in any new values")
8384
f.BoolVar(&diff.resetValues, "reset-values", false, "reset the values to the ones built into the chart and merge in any new values")
8485
f.BoolVar(&diff.allowUnreleased, "allow-unreleased", false, "enables diffing of releases that are not yet deployed via Helm")
86+
f.BoolVar(&diff.noHooks, "no-hooks", false, "disable diffing of hooks")
8587
f.BoolVar(&diff.devel, "devel", false, "use development versions, too. Equivalent to version '>0.0.0-0'. If --version is set, this is ignored.")
8688
f.StringArrayVar(&diff.suppressedKinds, "suppress", []string{}, "allows suppression of the values listed in the diff output")
8789
f.IntVarP(&diff.outputContext, "context", "C", -1, "output NUM lines of context around changes")
@@ -158,8 +160,13 @@ func (d *diffCmd) run() error {
158160
return prettyError(err)
159161
}
160162

161-
currentSpecs = manifest.ParseRelease(releaseResponse.Release)
162-
newSpecs = manifest.ParseRelease(upgradeResponse.Release)
163+
if d.noHooks {
164+
currentSpecs = manifest.Parse(releaseResponse.Release.Manifest, releaseResponse.Release.Namespace)
165+
newSpecs = manifest.Parse(upgradeResponse.Release.Manifest, upgradeResponse.Release.Namespace)
166+
} else {
167+
currentSpecs = manifest.ParseRelease(releaseResponse.Release)
168+
newSpecs = manifest.ParseRelease(upgradeResponse.Release)
169+
}
163170
}
164171

165172
seenAnyChanges := diff.DiffManifests(currentSpecs, newSpecs, d.suppressedKinds, d.outputContext, os.Stdout)

0 commit comments

Comments
 (0)