Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
forked fromdrone/go-scm

Commit210d615

Browse files
Merge pull requestdrone#33 from jstrachan/stuff
fix: avoid failures on bitbucket cluster
2 parentsf4dbd5f +4a1196d commit210d615

File tree

3 files changed

+71
-35
lines changed

3 files changed

+71
-35
lines changed

‎scm/driver/bitbucket/issue.go‎

Lines changed: 33 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,70 +15,86 @@ type issueService struct {
1515
}
1616

1717
func (s*issueService)Search(context.Context, scm.SearchOptions) ([]*scm.SearchIssue,*scm.Response,error) {
18-
// TODOimplemment
18+
// TODOimplement
1919
returnnil,nil,nil
2020
}
2121

2222
func (s*issueService)AssignIssue(ctx context.Context,repostring,numberint,logins []string) (*scm.Response,error) {
23-
panic("implement me")
23+
// TODO implement
24+
returnnil,nil
2425
}
2526

2627
func (s*issueService)UnassignIssue(ctx context.Context,repostring,numberint,logins []string) (*scm.Response,error) {
27-
panic("implement me")
28+
// TODO implement
29+
returnnil,nil
2830
}
2931

3032
func (s*issueService)ListEvents(context.Context,string,int, scm.ListOptions) ([]*scm.ListedIssueEvent,*scm.Response,error) {
31-
panic("implement me")
33+
// TODO implement
34+
returnnil,nil,nil
3235
}
3336

3437
func (s*issueService)ListLabels(context.Context,string,int, scm.ListOptions) ([]*scm.Label,*scm.Response,error) {
35-
panic("implement me")
38+
// TODO implement
39+
returnnil,nil,nil
3640
}
3741

3842
func (s*issueService)AddLabel(ctx context.Context,repostring,numberint,labelstring) (*scm.Response,error) {
39-
returnnil,scm.ErrNotSupported
43+
// TODO implement
44+
returnnil,nil
4045
}
4146

4247
func (s*issueService)DeleteLabel(ctx context.Context,repostring,numberint,labelstring) (*scm.Response,error) {
43-
returnnil,scm.ErrNotSupported
48+
// TODO implement
49+
returnnil,nil
4450
}
4551

4652
func (s*issueService)Find(ctx context.Context,repostring,numberint) (*scm.Issue,*scm.Response,error) {
47-
returnnil,nil,scm.ErrNotSupported
53+
// TODO implement
54+
returnnil,nil,nil
4855
}
4956

5057
func (s*issueService)FindComment(ctx context.Context,repostring,index,idint) (*scm.Comment,*scm.Response,error) {
51-
returnnil,nil,scm.ErrNotSupported
58+
// TODO implement
59+
returnnil,nil,nil
5260
}
5361

5462
func (s*issueService)List(ctx context.Context,repostring,opts scm.IssueListOptions) ([]*scm.Issue,*scm.Response,error) {
55-
returnnil,nil,scm.ErrNotSupported
63+
// TODO implement
64+
returnnil,nil,nil
5665
}
5766

5867
func (s*issueService)ListComments(ctx context.Context,repostring,indexint,opts scm.ListOptions) ([]*scm.Comment,*scm.Response,error) {
59-
returnnil,nil,scm.ErrNotSupported
68+
// TODO implement
69+
returnnil,nil,nil
6070
}
6171

6272
func (s*issueService)Create(ctx context.Context,repostring,input*scm.IssueInput) (*scm.Issue,*scm.Response,error) {
63-
returnnil,nil,scm.ErrNotSupported
73+
// TODO implement
74+
returnnil,nil,nil
6475
}
6576

6677
func (s*issueService)CreateComment(ctx context.Context,repostring,numberint,input*scm.CommentInput) (*scm.Comment,*scm.Response,error) {
67-
returnnil,nil,scm.ErrNotSupported
78+
// TODO implement
79+
returnnil,nil,nil
6880
}
6981

7082
func (s*issueService)DeleteComment(ctx context.Context,repostring,number,idint) (*scm.Response,error) {
71-
returnnil,scm.ErrNotSupported
83+
// TODO implement
84+
returnnil,nil
7285
}
7386

7487
func (s*issueService)Close(ctx context.Context,repostring,numberint) (*scm.Response,error) {
75-
returnnil,scm.ErrNotSupported
88+
// TODO implement
89+
returnnil,nil
7690
}
7791

7892
func (s*issueService)Lock(ctx context.Context,repostring,numberint) (*scm.Response,error) {
79-
returnnil,scm.ErrNotSupported
93+
// TODO implement
94+
returnnil,nil
8095
}
8196

8297
func (s*issueService)Unlock(ctx context.Context,repostring,numberint) (*scm.Response,error) {
83-
returnnil,scm.ErrNotSupported
98+
// TODO implement
99+
returnnil,nil
84100
}

‎scm/driver/bitbucket/issue_test.go‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,70 +13,70 @@ import (
1313

1414
funcTestIssueFind(t*testing.T) {
1515
_,_,err:=NewDefault().Issues.Find(context.Background(),"",0)
16-
iferr!=scm.ErrNotSupported {
16+
iferr!=nil&&err!=scm.ErrNotSupported {
1717
t.Errorf("Expect Not Supported error")
1818
}
1919
}
2020

2121
funcTestIssueCommentFind(t*testing.T) {
2222
_,_,err:=NewDefault().Issues.FindComment(context.Background(),"",0,0)
23-
iferr!=scm.ErrNotSupported {
23+
iferr!=nil&&err!=scm.ErrNotSupported {
2424
t.Errorf("Expect Not Supported error")
2525
}
2626
}
2727

2828
funcTestIssueList(t*testing.T) {
2929
_,_,err:=NewDefault().Issues.List(context.Background(),"", scm.IssueListOptions{})
30-
iferr!=scm.ErrNotSupported {
30+
iferr!=nil&&err!=scm.ErrNotSupported {
3131
t.Errorf("Expect Not Supported error")
3232
}
3333
}
3434

3535
funcTestIssueListComments(t*testing.T) {
3636
_,_,err:=NewDefault().Issues.ListComments(context.Background(),"",0, scm.ListOptions{})
37-
iferr!=scm.ErrNotSupported {
37+
iferr!=nil&&err!=scm.ErrNotSupported {
3838
t.Errorf("Expect Not Supported error")
3939
}
4040
}
4141

4242
funcTestIssueCreate(t*testing.T) {
4343
_,_,err:=NewDefault().Issues.Create(context.Background(),"",&scm.IssueInput{})
44-
iferr!=scm.ErrNotSupported {
44+
iferr!=nil&&err!=scm.ErrNotSupported {
4545
t.Errorf("Expect Not Supported error")
4646
}
4747
}
4848

4949
funcTestIssueCreateComment(t*testing.T) {
5050
_,_,err:=NewDefault().Issues.CreateComment(context.Background(),"",0,&scm.CommentInput{})
51-
iferr!=scm.ErrNotSupported {
51+
iferr!=nil&&err!=scm.ErrNotSupported {
5252
t.Errorf("Expect Not Supported error")
5353
}
5454
}
5555

5656
funcTestIssueCommentDelete(t*testing.T) {
5757
_,err:=NewDefault().Issues.DeleteComment(context.Background(),"",0,0)
58-
iferr!=scm.ErrNotSupported {
58+
iferr!=nil&&err!=scm.ErrNotSupported {
5959
t.Errorf("Expect Not Supported error")
6060
}
6161
}
6262

6363
funcTestIssueClose(t*testing.T) {
6464
_,err:=NewDefault().Issues.Close(context.Background(),"",0)
65-
iferr!=scm.ErrNotSupported {
65+
iferr!=nil&&err!=scm.ErrNotSupported {
6666
t.Errorf("Expect Not Supported error")
6767
}
6868
}
6969

7070
funcTestIssueLock(t*testing.T) {
7171
_,err:=NewDefault().Issues.Lock(context.Background(),"",0)
72-
iferr!=scm.ErrNotSupported {
72+
iferr!=nil&&err!=scm.ErrNotSupported {
7373
t.Errorf("Expect Not Supported error")
7474
}
7575
}
7676

7777
funcTestIssueUnlock(t*testing.T) {
7878
_,err:=NewDefault().Issues.Unlock(context.Background(),"",0)
79-
iferr!=scm.ErrNotSupported {
79+
iferr!=nil&&err!=scm.ErrNotSupported {
8080
t.Errorf("Expect Not Supported error")
8181
}
8282
}

‎scm/factory/examples/pr/main.go‎

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"strconv"
88

99
"github.com/ghodss/yaml"
10+
"github.com/jenkins-x/go-scm/scm"
1011
"github.com/pkg/errors"
1112

1213
"github.com/jenkins-x/go-scm/scm/factory"
@@ -15,27 +16,46 @@ import (
1516

1617
funcmain() {
1718
args:=os.Args
18-
iflen(args)<3 {
19+
iflen(args)<2 {
1920
fmt.Printf("usage: org/repo prNumber")
2021
return
2122
}
2223
repo:=args[1]
23-
prText:=args[2]
24-
number,err:=strconv.Atoi(prText)
24+
25+
client,err:=factory.NewClientFromEnvironment()
2526
iferr!=nil {
26-
helpers.Fail(errors.Wrapf(err,"failed to parse PR number: %s",prText))
27+
helpers.Fail(err)
2728
return
2829
}
30+
ctx:=context.Background()
2931

30-
client,err:=factory.NewClientFromEnvironment()
32+
iflen(args)<3 {
33+
fmt.Printf("Getting PRs\n")
34+
35+
prs,_,err:=client.PullRequests.List(ctx,repo, scm.PullRequestListOptions{})
36+
iferr!=nil {
37+
helpers.Fail(err)
38+
return
39+
}
40+
for_,pr:=rangeprs {
41+
fmt.Printf("Found PullRequest:\n")
42+
data,err:=yaml.Marshal(pr)
43+
iferr!=nil {
44+
helpers.Fail(errors.Wrap(err,"failed to marshal PR as YAML"))
45+
return
46+
}
47+
fmt.Printf("%s:\n",string(data))
48+
}
49+
}
50+
prText:=args[2]
51+
number,err:=strconv.Atoi(prText)
3152
iferr!=nil {
32-
helpers.Fail(err)
53+
helpers.Fail(errors.Wrapf(err,"failed to parse PR number: %s",prText))
3354
return
3455
}
3556

36-
fmt.Printf("GettingPRs\n")
57+
fmt.Printf("GettingPR\n")
3758

38-
ctx:=context.Background()
3959
pr,_,err:=client.PullRequests.Find(ctx,repo,number)
4060
iferr!=nil {
4161
helpers.Fail(err)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp