From 3419f9aeb9d25deaf8c57253f6af56d4297d54f9 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Doumenjou Date: Tue, 5 Mar 2019 18:14:03 +0100 Subject: [PATCH] Remove the bug command --- .github/ISSUE_TEMPLATE.md | 1 - .github/ISSUE_TEMPLATE/Bug_report.md | 1 - .github/ISSUE_TEMPLATE/Feature_request.md | 1 - cmd/bug/bug.go | 171 ------------------ cmd/bug/bug_test.go | 45 ----- cmd/traefik/traefik.go | 2 - .../content/contributing/submitting-issues.md | 2 +- docs/content/operations/cli.md | 9 - 8 files changed, 1 insertion(+), 231 deletions(-) delete mode 100644 cmd/bug/bug.go delete mode 100644 cmd/bug/bug_test.go diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index b49ef027c..6a204a12e 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -23,7 +23,6 @@ If you intend to ask a support question: DO NOT FILE AN ISSUE. HOW TO WRITE A GOOD ISSUE? - Respect the issue template as much as possible. -- If possible, use the command `traefik bug`. See https://www.youtube.com/watch?v=Lyz62L8m93I. - The title should be short and descriptive. - Explain the conditions which led you to report this issue: the context. - The context should lead to something, an idea or a problem that you’re facing. diff --git a/.github/ISSUE_TEMPLATE/Bug_report.md b/.github/ISSUE_TEMPLATE/Bug_report.md index c450f8720..49cf3217a 100644 --- a/.github/ISSUE_TEMPLATE/Bug_report.md +++ b/.github/ISSUE_TEMPLATE/Bug_report.md @@ -27,7 +27,6 @@ Bug HOW TO WRITE A GOOD BUG REPORT? - Respect the issue template as much as possible. -- If possible, use the command `traefik bug`. See https://www.youtube.com/watch?v=Lyz62L8m93I. - The title should be short and descriptive. - Explain the conditions which led you to report this issue: the context. - The context should lead to something, an idea or a problem that you’re facing. diff --git a/.github/ISSUE_TEMPLATE/Feature_request.md b/.github/ISSUE_TEMPLATE/Feature_request.md index c9f4a6f1a..fd788bb8f 100644 --- a/.github/ISSUE_TEMPLATE/Feature_request.md +++ b/.github/ISSUE_TEMPLATE/Feature_request.md @@ -27,7 +27,6 @@ Feature HOW TO WRITE A GOOD ISSUE? - Respect the issue template as much as possible. -- If possible, use the command `traefik bug`. See https://www.youtube.com/watch?v=Lyz62L8m93I. - The title should be short and descriptive. - Explain the conditions which led you to report this issue: the context. - The context should lead to something, an idea or a problem that you’re facing. diff --git a/cmd/bug/bug.go b/cmd/bug/bug.go deleted file mode 100644 index 0fe6ce175..000000000 --- a/cmd/bug/bug.go +++ /dev/null @@ -1,171 +0,0 @@ -package bug - -import ( - "bytes" - "fmt" - "net/url" - "os/exec" - "runtime" - "text/template" - - "github.com/containous/flaeg" - "github.com/containous/traefik/anonymize" - "github.com/containous/traefik/cmd" - "github.com/containous/traefik/cmd/version" -) - -const ( - bugTracker = "https://github.com/containous/traefik/issues/new" - bugTemplate = ` - -### Do you want to request a *feature* or report a *bug*? - -(If you intend to ask a support question: **DO NOT FILE AN ISSUE**. -Use [Stack Overflow](https://stackoverflow.com/questions/tagged/traefik) -or [Slack](https://slack.traefik.io) instead.) - - - -### What did you do? - - - - -### What did you expect to see? - - - -### What did you see instead? - - - -### Output of ` + "`" + `traefik version` + "`" + `: (_What version of Traefik are you using?_) - -` + "```" + ` -{{.Version}} -` + "```" + ` - -### What is your environment & configuration (arguments, toml, provider, platform, ...)? - -` + "```" + `json -{{.Configuration}} -` + "```" + ` - - - -### If applicable, please paste the log output at DEBUG level (` + "`" + `--logLevel=DEBUG` + "`" + ` switch) - -` + "```" + ` -(paste your output here) -` + "```" + ` - -` -) - -// NewCmd builds a new Bug command -func NewCmd(traefikConfiguration *cmd.TraefikConfiguration, traefikPointersConfiguration *cmd.TraefikConfiguration) *flaeg.Command { - - // version Command init - return &flaeg.Command{ - Name: "bug", - Description: `Report an issue on Traefik bugtracker`, - Config: traefikConfiguration, - DefaultPointersConfig: traefikPointersConfiguration, - Run: runCmd(traefikConfiguration), - Metadata: map[string]string{ - "parseAllSources": "true", - }, - } -} - -func runCmd(traefikConfiguration *cmd.TraefikConfiguration) func() error { - return func() error { - - body, err := createReport(traefikConfiguration) - if err != nil { - return err - } - - sendReport(body) - - return nil - } -} - -func createReport(traefikConfiguration *cmd.TraefikConfiguration) (string, error) { - var versionPrint bytes.Buffer - if err := version.GetPrint(&versionPrint); err != nil { - return "", err - } - - tmpl, err := template.New("bug").Parse(bugTemplate) - if err != nil { - return "", err - } - - config, err := anonymize.Do(traefikConfiguration, true) - if err != nil { - return "", err - } - - v := struct { - Version string - Configuration string - }{ - Version: versionPrint.String(), - Configuration: config, - } - - var bug bytes.Buffer - if err := tmpl.Execute(&bug, v); err != nil { - return "", err - } - - return bug.String(), nil -} - -func sendReport(body string) { - URL := bugTracker + "?body=" + url.QueryEscape(body) - if err := openBrowser(URL); err != nil { - fmt.Printf("Please file a new issue at %s using this template:\n\n", bugTracker) - fmt.Print(body) - } -} - -func openBrowser(u string) error { - var err error - switch runtime.GOOS { - case "linux": - err = exec.Command("xdg-open", u).Start() - case "windows": - err = exec.Command("rundll32", "url.dll,FileProtocolHandler", u).Start() - case "darwin": - err = exec.Command("open", u).Start() - default: - err = fmt.Errorf("unsupported platform") - } - return err -} diff --git a/cmd/bug/bug_test.go b/cmd/bug/bug_test.go deleted file mode 100644 index 687cd87e4..000000000 --- a/cmd/bug/bug_test.go +++ /dev/null @@ -1,45 +0,0 @@ -package bug - -import ( - "testing" - - "github.com/containous/traefik/anonymize" - "github.com/containous/traefik/cmd" - "github.com/containous/traefik/config/static" - "github.com/stretchr/testify/assert" -) - -func Test_createReport(t *testing.T) { - traefikConfiguration := &cmd.TraefikConfiguration{ - ConfigFile: "FOO", - Configuration: static.Configuration{ - EntryPoints: static.EntryPoints{ - "goo": &static.EntryPoint{ - Address: "hoo.bar", - }, - }, - }, - } - - report, err := createReport(traefikConfiguration) - assert.NoError(t, err, report) - - // exported anonymous configuration - assert.NotContains(t, "hoo.bar", report) -} - -func Test_anonymize_traefikConfiguration(t *testing.T) { - traefikConfiguration := &cmd.TraefikConfiguration{ - ConfigFile: "FOO", - Configuration: static.Configuration{ - EntryPoints: static.EntryPoints{ - "goo": &static.EntryPoint{ - Address: "hoo.bar", - }, - }, - }, - } - _, err := anonymize.Do(traefikConfiguration, true) - assert.NoError(t, err) - assert.Equal(t, "hoo.bar", traefikConfiguration.Configuration.EntryPoints["goo"].Address) -} diff --git a/cmd/traefik/traefik.go b/cmd/traefik/traefik.go index fea984995..7a1934945 100644 --- a/cmd/traefik/traefik.go +++ b/cmd/traefik/traefik.go @@ -17,7 +17,6 @@ import ( "github.com/containous/staert" "github.com/containous/traefik/autogen/genstatic" "github.com/containous/traefik/cmd" - "github.com/containous/traefik/cmd/bug" "github.com/containous/traefik/cmd/healthcheck" "github.com/containous/traefik/cmd/storeconfig" cmdVersion "github.com/containous/traefik/cmd/version" @@ -134,7 +133,6 @@ Complete documentation is available at https://traefik.io`, // add commands f.AddCommand(cmdVersion.NewCmd()) - f.AddCommand(bug.NewCmd(traefikConfiguration, traefikPointersConfiguration)) f.AddCommand(storeConfigCmd) f.AddCommand(healthcheck.NewCmd(traefikConfiguration, traefikPointersConfiguration)) diff --git a/docs/content/contributing/submitting-issues.md b/docs/content/contributing/submitting-issues.md index e9237721e..18d342058 100644 --- a/docs/content/contributing/submitting-issues.md +++ b/docs/content/contributing/submitting-issues.md @@ -23,7 +23,7 @@ The title must be short and descriptive. (~60 characters) ## Description -Follow the [issue template](https://github.com/containous/traefik/blob/master/.github/ISSUE_TEMPLATE.md) as much as possible, and make use of the `traefik bug` command if you can (see the [video on Youtube](https://www.youtube.com/watch?v=Lyz62L8m93I)). +Follow the [issue template](https://github.com/containous/traefik/blob/master/.github/ISSUE_TEMPLATE.md) as much as possible. Explain us in which conditions you encountered the issue, what is your context. diff --git a/docs/content/operations/cli.md b/docs/content/operations/cli.md index 9f9e478c1..843ee0177 100644 --- a/docs/content/operations/cli.md +++ b/docs/content/operations/cli.md @@ -13,7 +13,6 @@ Available commands: - `version` : Print version - `storeconfig` : Store the static Traefik configuration into a Key-value stores. Please refer to the `Store Traefik configuration`(TODO: add doc and link) section to get documentation on it. -- `bug`: The easiest way to submit a pre-filled issue. - `healthcheck`: Calls Traefik `/ping` to check health. Each command can have additional flags. @@ -35,14 +34,6 @@ docker run traefik[:version] --help # ex: docker run traefik:1.5 --help ``` -## Command: bug - -The easiest way to submit a pre-filled issue on [Traefik GitHub](https://github.com/containous/traefik)! Watch [this demo](https://www.youtube.com/watch?v=Lyz62L8m93I) for more information. - -```bash -traefik bug -``` - ### Command: healthcheck Checks the health of Traefik.