forked from drone/go-scm
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request drone#130 from raphendyr/stash-pull-request
Implement parsing/handling for missing pull request webhook events for BitBucket Server (Stash) driver
- Loading branch information
Showing
15 changed files
with
882 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,53 @@ | ||
{} | ||
{ | ||
"Action": "closed", | ||
"Repo": { | ||
"ID": "1", | ||
"Namespace": "PRJ", | ||
"Name": "my-repo", | ||
"Perm": null, | ||
"Branch": "master", | ||
"Private": true, | ||
"Clone": "", | ||
"CloneSSH": "", | ||
"Link": "", | ||
"Created": "0001-01-01T00:00:00Z", | ||
"Updated": "0001-01-01T00:00:00Z" | ||
}, | ||
"PullRequest": { | ||
"Number": 2, | ||
"Title": "added LICENSE", | ||
"Body": "added BSD license text", | ||
"Sha": "b9eaed50a03c073b20dfa82e5e753d295e7f0e56", | ||
"Ref": "refs/pull-requests/2/from", | ||
"Source": "develop", | ||
"Target": "master", | ||
"Fork": "PRJ/my-repo", | ||
"Link": "", | ||
"Closed": true, | ||
"Merged": false, | ||
"Base": { | ||
"Name": "master", | ||
"Path": "refs/heads/master", | ||
"Sha": "823b2230a56056231c9425d63758fa87078a66b4" | ||
}, | ||
"Head": { | ||
"Name": "develop", | ||
"Path": "refs/heads/develop", | ||
"Sha": "b9eaed50a03c073b20dfa82e5e753d295e7f0e56" | ||
}, | ||
"Author": { | ||
"Login": "jcitizen", | ||
"Name": "Jane Citizen", | ||
"Email": "[email protected]", | ||
"Avatar": "https://www.gravatar.com/avatar/9e26471d35a78862c17e467d87cddedf.jpg" | ||
}, | ||
"Created": "2018-07-05T12:21:30-07:00", | ||
"Updated": "2018-07-05T12:30:48-07:00" | ||
}, | ||
"Sender": { | ||
"Login": "jcitizen", | ||
"Name": "Jane Citizen", | ||
"Email": "[email protected]", | ||
"Avatar": "https://www.gravatar.com/avatar/9e26471d35a78862c17e467d87cddedf.jpg" | ||
} | ||
} |
159 changes: 159 additions & 0 deletions
159
scm/driver/stash/testdata/webhooks/pr_from_ref_updated.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
{ | ||
"eventKey": "pr:from_ref_updated", | ||
"date": "2021-11-23T10:02:52+0000", | ||
"actor": { | ||
"name": "jcitizen", | ||
"emailAddress": "[email protected]", | ||
"id": 1, | ||
"displayName": "Jane Citizen", | ||
"active": true, | ||
"slug": "jcitizen", | ||
"type": "NORMAL", | ||
"links": { | ||
"self": [ | ||
{ | ||
"href": "http://example.com:7990/users/jcitizen" | ||
} | ||
] | ||
} | ||
}, | ||
"pullRequest": { | ||
"id": 2, | ||
"version": 0, | ||
"title": "added LICENSE", | ||
"description": "added BSD license text", | ||
"state": "OPEN", | ||
"open": true, | ||
"closed": false, | ||
"createdDate": 1637591800463, | ||
"updatedDate": 1637661772258, | ||
"fromRef": { | ||
"id": "refs/heads/feature-2", | ||
"displayId": "feature-2", | ||
"latestCommit": "c00d0f269a9844dd168f72f6a9d78a9cff49a318", | ||
"type": "BRANCH", | ||
"repository": { | ||
"slug": "my-repo", | ||
"id": 1, | ||
"name": "my-repo", | ||
"hierarchyId": "5aa23c1a1280b0c0acce", | ||
"scmId": "git", | ||
"state": "AVAILABLE", | ||
"statusMessage": "Available", | ||
"forkable": true, | ||
"project": { | ||
"key": "PRJ", | ||
"id": 2, | ||
"name": "PRJ", | ||
"public": false, | ||
"type": "NORMAL", | ||
"links": { | ||
"self": [ | ||
{ | ||
"href": "http://example.com:7990/projects/PRJ" | ||
} | ||
] | ||
} | ||
}, | ||
"public": false, | ||
"links": { | ||
"clone": [ | ||
{ | ||
"href": "http://example.com:7990/scm/prj/my-repo.git", | ||
"name": "http" | ||
}, | ||
{ | ||
"href": "ssh://[email protected]:7999/prj/my-repo.git", | ||
"name": "ssh" | ||
} | ||
], | ||
"self": [ | ||
{ | ||
"href": "http://example.com:7990/projects/PRJ/repos/my-repo/browse" | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
"toRef": { | ||
"id": "refs/heads/master", | ||
"displayId": "master", | ||
"type": "BRANCH", | ||
"latestCommit": "823b2230a56056231c9425d63758fa87078a66b4", | ||
"repository": { | ||
"slug": "my-repo", | ||
"id": 1, | ||
"name": "my-repo", | ||
"hierarchyId": "5aa23c1a1280b0c0acce", | ||
"scmId": "git", | ||
"state": "AVAILABLE", | ||
"statusMessage": "Available", | ||
"forkable": true, | ||
"project": { | ||
"key": "PRJ", | ||
"id": 2, | ||
"name": "PRJ", | ||
"public": false, | ||
"type": "NORMAL", | ||
"links": { | ||
"self": [ | ||
{ | ||
"href": "http://example.com:7990/projects/PRJ" | ||
} | ||
] | ||
} | ||
}, | ||
"public": false, | ||
"links": { | ||
"clone": [ | ||
{ | ||
"href": "http://example.com:7990/scm/prj/my-repo.git", | ||
"name": "http" | ||
}, | ||
{ | ||
"href": "ssh://[email protected]:7999/prj/my-repo.git", | ||
"name": "ssh" | ||
} | ||
], | ||
"self": [ | ||
{ | ||
"href": "http://example.com:7990/projects/PRJ/repos/my-repo/browse" | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
"locked": false, | ||
"author": { | ||
"user": { | ||
"name": "jcitizen", | ||
"emailAddress": "[email protected]", | ||
"id": 1, | ||
"displayName": "Jane Citizen", | ||
"active": true, | ||
"slug": "jcitizen", | ||
"type": "NORMAL", | ||
"links": { | ||
"self": [ | ||
{ | ||
"href": "http://example.com:7990/users/jcitizen" | ||
} | ||
] | ||
} | ||
}, | ||
"role": "AUTHOR", | ||
"approved": false, | ||
"status": "UNAPPROVED" | ||
}, | ||
"reviewers": [], | ||
"participants": [], | ||
"links": { | ||
"self": [ | ||
{ | ||
"href": "http://example.com:7990/projects/PRJ/repos/my-repo/pull-requests/2" | ||
} | ||
] | ||
} | ||
}, | ||
"previousFromHash": "caf52ccb18c039cd9b930ed1f7b3edfb34cb92dd" | ||
} |
53 changes: 53 additions & 0 deletions
53
scm/driver/stash/testdata/webhooks/pr_from_ref_updated.json.golden
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
{ | ||
"Action": "synchronized", | ||
"Repo": { | ||
"ID": "1", | ||
"Namespace": "PRJ", | ||
"Name": "my-repo", | ||
"Perm": null, | ||
"Branch": "master", | ||
"Private": true, | ||
"Clone": "http://example.com:7990/scm/prj/my-repo.git", | ||
"CloneSSH": "ssh://[email protected]:7999/prj/my-repo.git", | ||
"Link": "http://example.com:7990/projects/PRJ/repos/my-repo/browse", | ||
"Created": "0001-01-01T00:00:00Z", | ||
"Updated": "0001-01-01T00:00:00Z" | ||
}, | ||
"PullRequest": { | ||
"Number": 2, | ||
"Title": "added LICENSE", | ||
"Body": "added BSD license text", | ||
"Sha": "c00d0f269a9844dd168f72f6a9d78a9cff49a318", | ||
"Ref": "refs/pull-requests/2/from", | ||
"Source": "feature-2", | ||
"Target": "master", | ||
"Fork": "PRJ/my-repo", | ||
"Link": "http://example.com:7990/projects/PRJ/repos/my-repo/pull-requests/2", | ||
"Closed": false, | ||
"Merged": false, | ||
"Base": { | ||
"Name": "master", | ||
"Path": "refs/heads/master", | ||
"Sha": "823b2230a56056231c9425d63758fa87078a66b4" | ||
}, | ||
"Head": { | ||
"Name": "feature-2", | ||
"Path": "refs/heads/feature-2", | ||
"Sha": "c00d0f269a9844dd168f72f6a9d78a9cff49a318" | ||
}, | ||
"Author": { | ||
"Login": "jcitizen", | ||
"Name": "Jane Citizen", | ||
"Email": "[email protected]", | ||
"Avatar": "https://www.gravatar.com/avatar/9e26471d35a78862c17e467d87cddedf.jpg" | ||
}, | ||
"Created": "2021-11-22T14:36:40Z", | ||
"Updated": "2021-11-23T10:02:52Z" | ||
}, | ||
"Sender": { | ||
"Login": "jcitizen", | ||
"Name": "Jane Citizen", | ||
"Email": "[email protected]", | ||
"Avatar": "https://www.gravatar.com/avatar/9e26471d35a78862c17e467d87cddedf.jpg" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.