diff --git a/plugin.go b/plugin.go index 11b04a5..f0bc4c0 100644 --- a/plugin.go +++ b/plugin.go @@ -53,6 +53,7 @@ func setPushEventCommand(p *Plugin) { upgrade := make([]string, 2) upgrade[0] = "upgrade" upgrade[1] = "--install" + if p.Config.Release != "" { upgrade = append(upgrade, p.Config.Release) } @@ -61,6 +62,10 @@ func setPushEventCommand(p *Plugin) { upgrade = append(upgrade, "--set") upgrade = append(upgrade, p.Config.Values) } + if p.Config.Namespace != "" { + upgrade = append(upgrade, "--namespace") + upgrade = append(upgrade, p.Config.Namespace) + } if p.Config.DryRun { upgrade = append(upgrade, "--dry-run") } diff --git a/plugin_test.go b/plugin_test.go index b9a3718..1a9f280 100644 --- a/plugin_test.go +++ b/plugin_test.go @@ -58,7 +58,7 @@ func TestGetHelmCommand(t *testing.T) { } setHelmCommand(plugin) res := strings.Join(plugin.Config.HelmCommand[:], " ") - expected := "upgrade --install test-release ./chart/test --set image.tag=v.0.1.0,nameOverride=my-over-app --dry-run --debug" + expected := "upgrade --install test-release ./chart/test --set image.tag=v.0.1.0,nameOverride=my-over-app --namespace default --dry-run --debug" if res != expected { t.Errorf("Result is %s and we expected %s", res, expected) }