Commit 70b9f11a authored by Michelle Noorali's avatar Michelle Noorali

feat(*): add disable hooks flag to `helm upgrade`

parent 8be3a34a
......@@ -162,6 +162,9 @@ message UpdateReleaseRequest {
hapi.chart.Config values = 3;
// dry_run, if true, will run through the release logic, but neither create
bool dry_run = 4;
// DisableHooks causes the server to skip running any hooks for the upgrade.
bool disable_hooks = 5;
}
// UpdateReleaseResponse is the response to an update request.
......
......@@ -34,12 +34,13 @@ argument can be a relative path to a packaged or unpackaged chart.
`
type upgradeCmd struct {
release string
chart string
out io.Writer
client helm.Interface
dryRun bool
valuesFile string
release string
chart string
out io.Writer
client helm.Interface
dryRun bool
disableHooks bool
valuesFile string
}
func newUpgradeCmd(client helm.Interface, out io.Writer) *cobra.Command {
......@@ -70,6 +71,7 @@ func newUpgradeCmd(client helm.Interface, out io.Writer) *cobra.Command {
f := cmd.Flags()
f.StringVarP(&upgrade.valuesFile, "values", "f", "", "path to a values YAML file")
f.BoolVar(&upgrade.dryRun, "dry-run", false, "simulate an upgrade")
f.BoolVar(&upgrade.disableHooks, "disable-hooks", false, "disable pre/post upgrade hooks")
return cmd
}
......@@ -88,7 +90,7 @@ func (u *upgradeCmd) run() error {
}
}
_, err = u.client.UpdateRelease(u.release, chartPath, helm.UpdateValueOverrides(rawVals), helm.UpgradeDryRun(u.dryRun))
_, err = u.client.UpdateRelease(u.release, chartPath, helm.UpdateValueOverrides(rawVals), helm.UpgradeDryRun(u.dryRun), helm.UpgradeDisableHooks(u.disableHooks))
if err != nil {
return prettyError(err)
}
......
......@@ -143,6 +143,13 @@ func DeleteDryRun(dry bool) DeleteOption {
}
}
// UpgradeDisableHooks will disable hooks for an upgrade operation.
func UpgradeDisableHooks(disable bool) UpdateOption {
return func(opts *options) {
opts.disableHooks = disable
}
}
// UpgradeDryRun will (if true) execute an upgrade as a dry run.
func UpgradeDryRun(dry bool) UpdateOption {
return func(opts *options) {
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment