Skip to content

Commit 20615f3

Browse files
authored
Add Global --debug Flag for REST API Calls (#615)
* feat: allow a debug flag for verbose output Signed-off-by: Ben McNicholl <[email protected]> * bug: redact token values from output of verbose logs Signed-off-by: Ben McNicholl <[email protected]> * chore: migrate REST functions to allow debug output Signed-off-by: Ben McNicholl <[email protected]> * chore: format code Signed-off-by: Ben McNicholl <[email protected]> --------- Signed-off-by: Ben McNicholl <[email protected]>
1 parent 402d81d commit 20615f3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+208
-49
lines changed

cmd/agent/list.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ Examples:
7171
}
7272

7373
func (c *ListCmd) Run(kongCtx *kong.Context, globals cli.GlobalFlags) error {
74-
f, err := factory.New()
74+
f, err := factory.New(factory.WithDebug(globals.EnableDebug()))
7575
if err != nil {
7676
return err
7777
}

cmd/agent/pause.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Examples:
4040
}
4141

4242
func (c *PauseCmd) Run(kongCtx *kong.Context, globals cli.GlobalFlags) error {
43-
f, err := factory.New()
43+
f, err := factory.New(factory.WithDebug(globals.EnableDebug()))
4444
if err != nil {
4545
return err
4646
}

cmd/agent/resume.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Examples:
2525
}
2626

2727
func (c *ResumeCmd) Run(kongCtx *kong.Context, globals cli.GlobalFlags) error {
28-
f, err := factory.New()
28+
f, err := factory.New(factory.WithDebug(globals.EnableDebug()))
2929
if err != nil {
3030
return err
3131
}

cmd/agent/stop.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Examples:
4949
}
5050

5151
func (c *StopCmd) Run(kongCtx *kong.Context, globals cli.GlobalFlags) error {
52-
f, err := factory.New()
52+
f, err := factory.New(factory.WithDebug(globals.EnableDebug()))
5353
if err != nil {
5454
return err
5555
}

cmd/agent/view.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Examples:
4242
}
4343

4444
func (c *ViewCmd) Run(kongCtx *kong.Context, globals cli.GlobalFlags) error {
45-
f, err := factory.New()
45+
f, err := factory.New(factory.WithDebug(globals.EnableDebug()))
4646
if err != nil {
4747
return err
4848
}

cmd/api/api.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ func buildFullEndpoint(endpoint, orgSlug string, isAnalytics bool) string {
8282
}
8383

8484
func (c *ApiCmd) Run(kongCtx *kong.Context, globals cli.GlobalFlags) error {
85-
f, err := factory.New()
85+
f, err := factory.New(factory.WithDebug(globals.EnableDebug()))
8686
if err != nil {
8787
return err
8888
}

cmd/artifacts/download.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Examples:
3131
}
3232

3333
func (c *DownloadCmd) Run(kongCtx *kong.Context, globals cli.GlobalFlags) error {
34-
f, err := factory.New()
34+
f, err := factory.New(factory.WithDebug(globals.EnableDebug()))
3535
if err != nil {
3636
return err
3737
}

cmd/artifacts/list.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Examples:
4848
}
4949

5050
func (c *ListCmd) Run(kongCtx *kong.Context, globals cli.GlobalFlags) error {
51-
f, err := factory.New()
51+
f, err := factory.New(factory.WithDebug(globals.EnableDebug()))
5252
if err != nil {
5353
return err
5454
}

cmd/build/cancel.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Examples:
3232
}
3333

3434
func (c *CancelCmd) Run(kongCtx *kong.Context, globals cli.GlobalFlags) error {
35-
f, err := factory.New()
35+
f, err := factory.New(factory.WithDebug(globals.EnableDebug()))
3636
if err != nil {
3737
return err
3838
}

cmd/build/create.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Examples:
4747

4848
func (c *CreateCmd) Run(kongCtx *kong.Context, globals cli.GlobalFlags) error {
4949
// Initialize factory
50-
f, err := factory.New()
50+
f, err := factory.New(factory.WithDebug(globals.EnableDebug()))
5151
if err != nil {
5252
return bkErrors.NewInternalError(err, "failed to initialize CLI", "This is likely a bug", "Report to Buildkite")
5353
}

0 commit comments

Comments
 (0)