diff --git a/main.go b/main.go index 49217ed..d234dba 100644 --- a/main.go +++ b/main.go @@ -129,6 +129,11 @@ func main() { Usage: "force resource update through delete/recreate if needed", EnvVar: "PLUGIN_FORCE,FORCE", }, + cli.BoolFlag{ + Name: "purge", + Usage: "purge on delete", + EnvVar: "PLUGIN_PURGE,PURGE", + }, } if err := app.Run(os.Args); err != nil { logrus.Fatal(err) diff --git a/plugin.go b/plugin.go index 3b66d66..eae6050 100644 --- a/plugin.go +++ b/plugin.go @@ -45,6 +45,7 @@ type ( Timeout string `json:"timeout"` Force bool `json:"force"` HelmRepos []string `json:"helm_repos"` + Purge bool `json:"purge"` } // Plugin default Plugin struct { @@ -68,6 +69,9 @@ func setDeleteCommand(p *Plugin) { if p.Config.DryRun { delete = append(delete, "--dry-run") } + if p.Config.Purge { + delete = append(delete, "--purge") + } p.command = delete } diff --git a/plugin_test.go b/plugin_test.go index ef8fbab..471295d 100644 --- a/plugin_test.go +++ b/plugin_test.go @@ -139,11 +139,12 @@ func TestGetHelmDeleteCommandOverried(t *testing.T) { Release: "test-release", Values: "image.tag=v.0.1.0,nameOverride=my-over-app", Wait: true, + Purge: true, }, } setHelmCommand(plugin) res := strings.Join(plugin.command[:], " ") - expected := "delete test-release --tiller-namespace default-tiller-ns --dry-run" + expected := "delete test-release --tiller-namespace default-tiller-ns --dry-run --purge" if res != expected { t.Errorf("Result is %s and we expected %s", res, expected) }