mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-09-20 05:24:51 +00:00
Add Bitbucket fixes to Release/2.8 (#4547)
Co-authored-by: Joan Flotats <joanflotats@bit2me.com>
This commit is contained in:
@@ -290,11 +290,11 @@ func (c *config) Dir(ctx context.Context, u *model.User, r *model.Repo, p *model
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Status creates a pipeline status for the Bitbucket commit.
|
// Status creates a pipeline status for the Bitbucket commit.
|
||||||
func (c *config) Status(ctx context.Context, user *model.User, repo *model.Repo, pipeline *model.Pipeline, _ *model.Workflow) error {
|
func (c *config) Status(ctx context.Context, user *model.User, repo *model.Repo, pipeline *model.Pipeline, workflow *model.Workflow) error {
|
||||||
status := internal.PipelineStatus{
|
status := internal.PipelineStatus{
|
||||||
State: convertStatus(pipeline.Status),
|
State: convertStatus(pipeline.Status),
|
||||||
Desc: common.GetPipelineStatusDescription(pipeline.Status),
|
Desc: common.GetPipelineStatusDescription(pipeline.Status),
|
||||||
Key: "Woodpecker",
|
Key: common.GetPipelineStatusContext(repo, pipeline, workflow),
|
||||||
URL: common.GetPipelineStatusURL(repo, pipeline, nil),
|
URL: common.GetPipelineStatusURL(repo, pipeline, nil),
|
||||||
}
|
}
|
||||||
return c.newClient(ctx, user).CreateStatus(repo.Owner, repo.Name, pipeline.Commit, &status)
|
return c.newClient(ctx, user).CreateStatus(repo.Owner, repo.Name, pipeline.Commit, &status)
|
||||||
|
@@ -171,14 +171,14 @@ func convertPullHook(from *internal.PullRequestHook) *model.Pipeline {
|
|||||||
pipeline := &model.Pipeline{
|
pipeline := &model.Pipeline{
|
||||||
Event: event,
|
Event: event,
|
||||||
Commit: from.PullRequest.Source.Commit.Hash,
|
Commit: from.PullRequest.Source.Commit.Hash,
|
||||||
Ref: fmt.Sprintf("refs/heads/%s", from.PullRequest.Source.Branch.Name),
|
Ref: fmt.Sprintf("refs/pull-requests/%d/from", from.PullRequest.ID),
|
||||||
Refspec: fmt.Sprintf("%s:%s",
|
Refspec: fmt.Sprintf("%s:%s",
|
||||||
from.PullRequest.Source.Branch.Name,
|
from.PullRequest.Source.Branch.Name,
|
||||||
from.PullRequest.Dest.Branch.Name,
|
from.PullRequest.Dest.Branch.Name,
|
||||||
),
|
),
|
||||||
ForgeURL: from.PullRequest.Links.HTML.Href,
|
ForgeURL: from.PullRequest.Links.HTML.Href,
|
||||||
Branch: from.PullRequest.Source.Branch.Name,
|
Branch: from.PullRequest.Source.Branch.Name,
|
||||||
Message: from.PullRequest.Desc,
|
Message: from.PullRequest.Title,
|
||||||
Avatar: from.Actor.Links.Avatar.Href,
|
Avatar: from.Actor.Links.Avatar.Href,
|
||||||
Author: from.Actor.Login,
|
Author: from.Actor.Login,
|
||||||
Sender: from.Actor.Login,
|
Sender: from.Actor.Login,
|
||||||
|
@@ -131,8 +131,9 @@ func Test_helper(t *testing.T) {
|
|||||||
hook.PullRequest.Source.Repo.FullName = "baz/bar"
|
hook.PullRequest.Source.Repo.FullName = "baz/bar"
|
||||||
hook.PullRequest.Source.Commit.Hash = "c8411d7"
|
hook.PullRequest.Source.Commit.Hash = "c8411d7"
|
||||||
hook.PullRequest.Links.HTML.Href = "https://bitbucket.org/foo/bar/pulls/5"
|
hook.PullRequest.Links.HTML.Href = "https://bitbucket.org/foo/bar/pulls/5"
|
||||||
hook.PullRequest.Desc = "updated README"
|
hook.PullRequest.Title = "updated README"
|
||||||
hook.PullRequest.Updated = time.Now()
|
hook.PullRequest.Updated = time.Now()
|
||||||
|
hook.PullRequest.ID = 1
|
||||||
|
|
||||||
pipeline := convertPullHook(hook)
|
pipeline := convertPullHook(hook)
|
||||||
g.Assert(pipeline.Event).Equal(model.EventPull)
|
g.Assert(pipeline.Event).Equal(model.EventPull)
|
||||||
@@ -141,9 +142,9 @@ func Test_helper(t *testing.T) {
|
|||||||
g.Assert(pipeline.Commit).Equal(hook.PullRequest.Source.Commit.Hash)
|
g.Assert(pipeline.Commit).Equal(hook.PullRequest.Source.Commit.Hash)
|
||||||
g.Assert(pipeline.Branch).Equal(hook.PullRequest.Source.Branch.Name)
|
g.Assert(pipeline.Branch).Equal(hook.PullRequest.Source.Branch.Name)
|
||||||
g.Assert(pipeline.ForgeURL).Equal(hook.PullRequest.Links.HTML.Href)
|
g.Assert(pipeline.ForgeURL).Equal(hook.PullRequest.Links.HTML.Href)
|
||||||
g.Assert(pipeline.Ref).Equal("refs/heads/change")
|
g.Assert(pipeline.Ref).Equal("refs/pull-requests/1/from")
|
||||||
g.Assert(pipeline.Refspec).Equal("change:main")
|
g.Assert(pipeline.Refspec).Equal("change:main")
|
||||||
g.Assert(pipeline.Message).Equal(hook.PullRequest.Desc)
|
g.Assert(pipeline.Message).Equal(hook.PullRequest.Title)
|
||||||
g.Assert(pipeline.Timestamp).Equal(hook.PullRequest.Updated.Unix())
|
g.Assert(pipeline.Timestamp).Equal(hook.PullRequest.Updated.Unix())
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user