Skip to content

Commit

Permalink
Merge pull request #297 from banzaicloud/support-bundle
Browse files Browse the repository at this point in the history
Debug bundle
  • Loading branch information
Máté Őry authored Sep 8, 2020
2 parents ee78206 + 79ce496 commit 145cf81
Show file tree
Hide file tree
Showing 8 changed files with 562 additions and 21 deletions.
7 changes: 3 additions & 4 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ func Init(version string, commitHash string, buildDate string, pipelineVersion s
buildDate,
pipelineVersion,
))

cli := cli.NewCli(os.Stdout, version)
command.AddCommands(rootCmd, cli)
}

// GetRootCommand returns the cli root command
Expand Down Expand Up @@ -103,10 +106,6 @@ func init() {
viper.SetDefault("cloudinfo.basepath", "https://try.pipeline.banzai.cloud/cloudinfo/api/v1")
viper.BindEnv("cloudinfo.basepath", "BANZAI_CLOUDINFO_BASEPATH")
viper.SetDefault("telescopes.basepath", "https://try.pipeline.banzai.cloud/recommender/api/v1")

cli := cli.NewCli(os.Stdout)

command.AddCommands(rootCmd, cli)
}

// initConfig reads in config file and ENV variables if set.
Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ require (
github.com/mitchellh/mapstructure v1.1.2
github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4
github.com/pquerna/cachecontrol v0.0.0-20180517163645-1555304b9b35 // indirect
github.com/shirou/gopsutil v2.20.7+incompatible
github.com/sirupsen/logrus v1.4.2
github.com/spf13/cast v1.3.0
github.com/spf13/cobra v1.0.0
Expand All @@ -28,6 +29,7 @@ require (
github.com/stretchr/testify v1.4.0
github.com/ttacon/chalk v0.0.0-20140724125006-76b3c8b611de
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45
golang.org/x/sys v0.0.0-20200819171115-d785dc25833f // indirect
golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1 // indirect
gopkg.in/square/go-jose.v2 v2.3.1 // indirect
gopkg.in/yaml.v2 v2.2.8
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,8 @@ github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40T
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q=
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/shirou/gopsutil v2.20.7+incompatible h1:Ymv4OD12d6zm+2yONe39VSmp2XooJe8za7ngOLW/o/w=
github.com/shirou/gopsutil v2.20.7+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
Expand Down Expand Up @@ -307,6 +309,8 @@ golang.org/x/sys v0.0.0-20190530182044-ad28b68e88f1/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20191022100944-742c48ecaeb7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42 h1:vEOn+mP2zCOVzKckCZy6YsCtDblrpj/w7B9nxGNELpg=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200819171115-d785dc25833f h1:KJuwZVtZBVzDmEDtB2zro9CXkD9O0dpCv4o2LHbQIAw=
golang.org/x/sys v0.0.0-20200819171115-d785dc25833f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand Down
11 changes: 9 additions & 2 deletions internal/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ type Cli interface {
Context() Context
OutputFormat() string
Home() string // Home is the path to the .banzai directory of the user
Version() string
}

type Context interface {
Expand All @@ -77,11 +78,13 @@ type banzaiCli struct {
cloudinfoClientOnce sync.Once
telescopesClient *telescopes.APIClient
telescopesClientOnce sync.Once
version string
}

func NewCli(out io.Writer) Cli {
func NewCli(out io.Writer, version string) Cli {
return &banzaiCli{
out: out,
out: out,
version: version,
}
}

Expand Down Expand Up @@ -411,3 +414,7 @@ func (c *banzaiCli) save() {
log.Fatalf("failed to write config: %v", err)
}
}

func (c *banzaiCli) Version() string {
return c.version
}
1 change: 1 addition & 0 deletions internal/cli/command/controlplane/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ func NewControlPlaneCommand(banzaiCli cli.Cli) *cobra.Command {
NewUpCommand(banzaiCli),
NewDownCommand(banzaiCli),
NewInitCommand(banzaiCli),
NewDebugCommand(banzaiCli),
)

return cmd
Expand Down
Loading

0 comments on commit 145cf81

Please sign in to comment.