@@ -250,7 +250,7 @@ func parseTS(headerTS string) (time.Time, error) {
250
250
// but this gives a nice hint to the user into their namespace event of where
251
251
// the issue was.
252
252
func (v * Provider ) checkWebhookSecretValidity (ctx context.Context , cw clockwork.Clock ) error {
253
- rl , resp , err := Wrap ( v , func () (* github.RateLimits , * github.Response , error ) {
253
+ rl , resp , err := WrapWithContext ( v , "check_rate_limit" , func () (* github.RateLimits , * github.Response , error ) {
254
254
return v .Client ().RateLimit .Get (ctx )
255
255
})
256
256
if resp != nil && resp .StatusCode == http .StatusNotFound {
@@ -340,7 +340,7 @@ func (v *Provider) GetTektonDir(ctx context.Context, runevent *info.Event, path,
340
340
v .Logger .Infof ("Using PipelineRun definition from source %s %s on commit SHA %s" , runevent .TriggerTarget .String (), prInfo , runevent .SHA )
341
341
}
342
342
343
- rootobjects , _ , err := Wrap ( v , func () (* github.Tree , * github.Response , error ) {
343
+ rootobjects , _ , err := WrapWithContext ( v , "get_root_tree" , func () (* github.Tree , * github.Response , error ) {
344
344
return v .Client ().Git .GetTree (ctx , runevent .Organization , runevent .Repository , revision , false )
345
345
})
346
346
if err != nil {
@@ -364,7 +364,7 @@ func (v *Provider) GetTektonDir(ctx context.Context, runevent *info.Event, path,
364
364
// there is a limit on this recursive calls to 500 entries, as documented here:
365
365
// https://docs.github.com/en/rest/reference/git#get-a-tree
366
366
// so we may need to address it in the future.
367
- tektonDirObjects , _ , err := Wrap ( v , func () (* github.Tree , * github.Response , error ) {
367
+ tektonDirObjects , _ , err := WrapWithContext ( v , "get_tekton_tree" , func () (* github.Tree , * github.Response , error ) {
368
368
return v .Client ().Git .GetTree (ctx , runevent .Organization , runevent .Repository , tektonDirSha ,
369
369
true )
370
370
})
@@ -387,7 +387,7 @@ func (v *Provider) GetCommitInfo(ctx context.Context, runevent *info.Event) erro
387
387
var commit * github.Commit
388
388
sha := runevent .SHA
389
389
if runevent .SHA == "" && runevent .HeadBranch != "" {
390
- branchinfo , _ , err := Wrap ( v , func () (* github.Branch , * github.Response , error ) {
390
+ branchinfo , _ , err := WrapWithContext ( v , "get_branch_info" , func () (* github.Branch , * github.Response , error ) {
391
391
return v .Client ().Repositories .GetBranch (ctx , runevent .Organization , runevent .Repository , runevent .HeadBranch , 1 )
392
392
})
393
393
if err != nil {
@@ -396,7 +396,7 @@ func (v *Provider) GetCommitInfo(ctx context.Context, runevent *info.Event) erro
396
396
sha = branchinfo .Commit .GetSHA ()
397
397
}
398
398
var err error
399
- commit , _ , err = Wrap ( v , func () (* github.Commit , * github.Response , error ) {
399
+ commit , _ , err = WrapWithContext ( v , "get_commit" , func () (* github.Commit , * github.Response , error ) {
400
400
return v .Client ().Git .GetCommit (ctx , runevent .Organization , runevent .Repository , sha )
401
401
})
402
402
if err != nil {
@@ -421,7 +421,7 @@ func (v *Provider) GetFileInsideRepo(ctx context.Context, runevent *info.Event,
421
421
ref = runevent .DefaultBranch
422
422
}
423
423
424
- fp , objects , _ , err := WrapGetContents ( v , func () (* github.RepositoryContent , []* github.RepositoryContent , * github.Response , error ) {
424
+ fp , objects , _ , err := WrapGetContentsWithContext ( v , "get_file_contents" , func () (* github.RepositoryContent , []* github.RepositoryContent , * github.Response , error ) {
425
425
return v .Client ().Repositories .GetContents (ctx , runevent .Organization ,
426
426
runevent .Repository , path , & github.RepositoryContentGetOptions {Ref : ref })
427
427
})
@@ -465,7 +465,7 @@ func (v *Provider) concatAllYamlFiles(ctx context.Context, objects []*github.Tre
465
465
466
466
// getPullRequest get a pull request details.
467
467
func (v * Provider ) getPullRequest (ctx context.Context , runevent * info.Event ) (* info.Event , error ) {
468
- pr , _ , err := Wrap ( v , func () (* github.PullRequest , * github.Response , error ) {
468
+ pr , _ , err := WrapWithContext ( v , "get_pull_request" , func () (* github.PullRequest , * github.Response , error ) {
469
469
return v .Client ().PullRequests .Get (ctx , runevent .Organization , runevent .Repository , runevent .PullRequestNumber )
470
470
})
471
471
if err != nil {
@@ -506,7 +506,7 @@ func (v *Provider) GetFiles(ctx context.Context, runevent *info.Event) (changedf
506
506
opt := & github.ListOptions {PerPage : v .PaginedNumber }
507
507
changedFiles := changedfiles.ChangedFiles {}
508
508
for {
509
- repoCommit , resp , err := Wrap ( v , func () ([]* github.CommitFile , * github.Response , error ) {
509
+ repoCommit , resp , err := WrapWithContext ( v , "list_pull_request_files" , func () ([]* github.CommitFile , * github.Response , error ) {
510
510
return v .Client ().PullRequests .ListFiles (ctx , runevent .Organization , runevent .Repository , runevent .PullRequestNumber , opt )
511
511
})
512
512
if err != nil {
@@ -537,7 +537,7 @@ func (v *Provider) GetFiles(ctx context.Context, runevent *info.Event) (changedf
537
537
538
538
if runevent .TriggerTarget == "push" {
539
539
changedFiles := changedfiles.ChangedFiles {}
540
- rC , _ , err := Wrap ( v , func () (* github.RepositoryCommit , * github.Response , error ) {
540
+ rC , _ , err := WrapWithContext ( v , "get_commit_files" , func () (* github.RepositoryCommit , * github.Response , error ) {
541
541
return v .Client ().Repositories .GetCommit (ctx , runevent .Organization , runevent .Repository , runevent .SHA , & github.ListOptions {})
542
542
})
543
543
if err != nil {
@@ -565,7 +565,7 @@ func (v *Provider) GetFiles(ctx context.Context, runevent *info.Event) (changedf
565
565
566
566
// getObject Get an object from a repository.
567
567
func (v * Provider ) getObject (ctx context.Context , sha string , runevent * info.Event ) ([]byte , error ) {
568
- blob , _ , err := Wrap ( v , func () (* github.Blob , * github.Response , error ) {
568
+ blob , _ , err := WrapWithContext ( v , "get_blob" , func () (* github.Blob , * github.Response , error ) {
569
569
return v .Client ().Git .GetBlob (ctx , runevent .Organization , runevent .Repository , sha )
570
570
})
571
571
if err != nil {
@@ -589,7 +589,7 @@ func ListRepos(ctx context.Context, v *Provider) ([]string, error) {
589
589
opt := & github.ListOptions {PerPage : v .PaginedNumber }
590
590
repoURLs := []string {}
591
591
for {
592
- repoList , resp , err := Wrap ( v , func () (* github.ListRepositories , * github.Response , error ) {
592
+ repoList , resp , err := WrapWithContext ( v , "list_app_repos" , func () (* github.ListRepositories , * github.Response , error ) {
593
593
return v .Client ().Apps .ListRepos (ctx , opt )
594
594
})
595
595
if err != nil {
@@ -609,7 +609,7 @@ func ListRepos(ctx context.Context, v *Provider) ([]string, error) {
609
609
func (v * Provider ) CreateToken (ctx context.Context , repository []string , event * info.Event ) (string , error ) {
610
610
for _ , r := range repository {
611
611
split := strings .Split (r , "/" )
612
- infoData , _ , err := Wrap ( v , func () (* github.Repository , * github.Response , error ) {
612
+ infoData , _ , err := WrapWithContext ( v , "get_repository" , func () (* github.Repository , * github.Response , error ) {
613
613
return v .Client ().Repositories .Get (ctx , split [0 ], split [1 ])
614
614
})
615
615
if err != nil {
@@ -647,7 +647,7 @@ func (v *Provider) isHeadCommitOfBranch(ctx context.Context, runevent *info.Even
647
647
"exiting... (hint: did you forget setting a secret on your repo?)" )
648
648
}
649
649
650
- branchInfo , _ , err := Wrap ( v , func () (* github.Branch , * github.Response , error ) {
650
+ branchInfo , _ , err := WrapWithContext ( v , "get_branch" , func () (* github.Branch , * github.Response , error ) {
651
651
return v .Client ().Repositories .GetBranch (ctx , runevent .Organization , runevent .Repository , branchName , 1 )
652
652
})
653
653
if err != nil {
@@ -675,7 +675,7 @@ func (v *Provider) CreateComment(ctx context.Context, event *info.Event, commit,
675
675
676
676
// List last page of the comments of the PR
677
677
if updateMarker != "" {
678
- comments , _ , err := Wrap ( v , func () ([]* github.IssueComment , * github.Response , error ) {
678
+ comments , _ , err := WrapWithContext ( v , "list_comments" , func () ([]* github.IssueComment , * github.Response , error ) {
679
679
return v .Client ().Issues .ListComments (ctx , event .Organization , event .Repository , event .PullRequestNumber , & github.IssueListCommentsOptions {
680
680
ListOptions : github.ListOptions {
681
681
Page : 1 ,
@@ -690,18 +690,19 @@ func (v *Provider) CreateComment(ctx context.Context, event *info.Event, commit,
690
690
re := regexp .MustCompile (regexp .QuoteMeta (updateMarker ))
691
691
for _ , comment := range comments {
692
692
if re .MatchString (comment .GetBody ()) {
693
- if _ , _ , err := Wrap ( v , func () (* github.IssueComment , * github.Response , error ) {
693
+ if _ , _ , err := WrapWithContext ( v , "edit_comment" , func () (* github.IssueComment , * github.Response , error ) {
694
694
return v .Client ().Issues .EditComment (ctx , event .Organization , event .Repository , comment .GetID (), & github.IssueComment {
695
695
Body : & commit ,
696
696
})
697
697
}); err != nil {
698
698
return err
699
699
}
700
+ return nil
700
701
}
701
702
}
702
703
}
703
704
704
- _ , _ , err := Wrap ( v , func () (* github.IssueComment , * github.Response , error ) {
705
+ _ , _ , err := WrapWithContext ( v , "create-comment" , func () (* github.IssueComment , * github.Response , error ) {
705
706
return v .Client ().Issues .CreateComment (ctx , event .Organization , event .Repository , event .PullRequestNumber , & github.IssueComment {
706
707
Body : & commit ,
707
708
})
0 commit comments