mirror of
https://github.com/zulip/zulip.git
synced 2025-11-11 09:27:43 +00:00
BIN
static/images/integrations/gitlab/001.png
Normal file
BIN
static/images/integrations/gitlab/001.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 101 KiB |
BIN
static/images/integrations/gitlab/002.png
Normal file
BIN
static/images/integrations/gitlab/002.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 40 KiB |
BIN
static/images/integrations/logos/gitlab.png
Normal file
BIN
static/images/integrations/logos/gitlab.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 29 KiB |
@@ -884,6 +884,33 @@
|
||||
|
||||
</div>
|
||||
|
||||
<div id="gitlab" class="integration-instructions">
|
||||
|
||||
<p>First, create the stream you'd like to use for GitLab notifications,
|
||||
and subscribe all interested parties to this stream. The integration will
|
||||
use the default stream <code>gitlab</code> if no stream is supplied in
|
||||
the URL; you still need to create the stream even if you are using this
|
||||
default.</p>
|
||||
|
||||
<p>Next, go to your repository page and click gear icon.
|
||||
From there, select <b>Webhooks</b>:</p>
|
||||
<p><img src="/static/images/integrations/gitlab/001.png" /></p>
|
||||
|
||||
<p>In the URL field, enter a URL constructed like this:
|
||||
|
||||
<p><code>{{ external_api_uri_subdomain }}/v1/external/gitlab?api_key=abcdefgh&stream=gitlab</code></p>
|
||||
|
||||
<p>where <code>api_key</code> is the API key of your Zulip
|
||||
bot.</p> Select the actions that you want to result in a
|
||||
Zulip notification and click <b>Add Webhook</b>.</p>
|
||||
|
||||
<p><b>Congratulations! You're done!</b><br />
|
||||
Your messages will look like this:</p>
|
||||
|
||||
<p><img class="screenshot" src="/static/images/integrations/gitlab/002.png" /></p>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="helloworld" class="integration-instructions">
|
||||
|
||||
<p>Learn how Zulip integrations work with this simple Hello World example!</p>
|
||||
|
||||
43
zerver/fixtures/gitlab/gitlab_add_tag.json
Normal file
43
zerver/fixtures/gitlab/gitlab_add_tag.json
Normal file
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"object_kind":"tag_push",
|
||||
"event_name":"tag_push",
|
||||
"before":"0000000000000000000000000000000000000000",
|
||||
"after":"eb6ae1e591e0819dc5bf187c6bfe18ec065a80e9",
|
||||
"ref":"refs/tags/xyz",
|
||||
"checkout_sha":"eb6ae1e591e0819dc5bf187c6bfe18ec065a80e9",
|
||||
"message":null,
|
||||
"user_id":670043,
|
||||
"user_name":"Tomasz Kolek",
|
||||
"user_email":"tomaszkolek0@gmail.com",
|
||||
"user_avatar":"https://secure.gravatar.com/avatar/116a6fdbcfd00466297a39174da11fbb?s=80\u0026d=identicon",
|
||||
"project_id":1534233,
|
||||
"project":{
|
||||
"name":"my-awesome-project",
|
||||
"description":"",
|
||||
"web_url":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"avatar_url":null,
|
||||
"git_ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"git_http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git",
|
||||
"namespace":"tomaszkolek0",
|
||||
"visibility_level":0,
|
||||
"path_with_namespace":"tomaszkolek0/my-awesome-project",
|
||||
"default_branch":"master",
|
||||
"homepage":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git"
|
||||
},
|
||||
"commits":[
|
||||
|
||||
],
|
||||
"total_commits_count":0,
|
||||
"repository":{
|
||||
"name":"my-awesome-project",
|
||||
"url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"description":"",
|
||||
"homepage":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"git_http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git",
|
||||
"git_ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"visibility_level":0
|
||||
}
|
||||
}
|
||||
65
zerver/fixtures/gitlab/gitlab_commit_note.json
Normal file
65
zerver/fixtures/gitlab/gitlab_commit_note.json
Normal file
@@ -0,0 +1,65 @@
|
||||
{
|
||||
"object_kind":"note",
|
||||
"user":{
|
||||
"name":"Tomasz Kolek",
|
||||
"username":"tomaszkolek0",
|
||||
"avatar_url":"https://secure.gravatar.com/avatar/116a6fdbcfd00466297a39174da11fbb?s=80\u0026d=identicon"
|
||||
},
|
||||
"project_id":1534233,
|
||||
"project":{
|
||||
"name":"my-awesome-project",
|
||||
"description":"",
|
||||
"web_url":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"avatar_url":null,
|
||||
"git_ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"git_http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git",
|
||||
"namespace":"tomaszkolek0",
|
||||
"visibility_level":0,
|
||||
"path_with_namespace":"tomaszkolek0/my-awesome-project",
|
||||
"default_branch":"master",
|
||||
"homepage":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git"
|
||||
},
|
||||
"object_attributes":{
|
||||
"id":14169211,
|
||||
"note":"nice commit",
|
||||
"noteable_type":"Commit",
|
||||
"author_id":670043,
|
||||
"created_at":"2016-08-22 19:17:30 UTC",
|
||||
"updated_at":"2016-08-22 19:17:30 UTC",
|
||||
"project_id":1534233,
|
||||
"attachment":null,
|
||||
"line_code":null,
|
||||
"commit_id":"66abd2da28809ffa128ed0447965cf11d7f863a7",
|
||||
"noteable_id":null,
|
||||
"st_diff":null,
|
||||
"system":false,
|
||||
"updated_by_id":null,
|
||||
"type":null,
|
||||
"position":null,
|
||||
"original_position":null,
|
||||
"resolved_at":null,
|
||||
"resolved_by_id":null,
|
||||
"discussion_id":"c748ca8fd85ec719e2d4d75c849cf7c616dc3955",
|
||||
"original_discussion_id":null,
|
||||
"url":"https://gitlab.com/tomaszkolek0/my-awesome-project/commit/66abd2da28809ffa128ed0447965cf11d7f863a7#note_14169211"
|
||||
},
|
||||
"repository":{
|
||||
"name":"my-awesome-project",
|
||||
"url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"description":"",
|
||||
"homepage":"https://gitlab.com/tomaszkolek0/my-awesome-project"
|
||||
},
|
||||
"commit":{
|
||||
"id":"66abd2da28809ffa128ed0447965cf11d7f863a7",
|
||||
"message":"b\n",
|
||||
"timestamp":"2016-08-17T21:17:54+02:00",
|
||||
"url":"https://gitlab.com/tomaszkolek0/my-awesome-project/commit/66abd2da28809ffa128ed0447965cf11d7f863a7",
|
||||
"author":{
|
||||
"name":"Tomasz Kolek",
|
||||
"email":"tomasz-kolek@o2.pl"
|
||||
}
|
||||
}
|
||||
}
|
||||
58
zerver/fixtures/gitlab/gitlab_issue_closed.json
Normal file
58
zerver/fixtures/gitlab/gitlab_issue_closed.json
Normal file
@@ -0,0 +1,58 @@
|
||||
{
|
||||
"object_kind":"issue",
|
||||
"user":{
|
||||
"name":"Tomasz Kolek",
|
||||
"username":"tomaszkolek0",
|
||||
"avatar_url":"https://secure.gravatar.com/avatar/116a6fdbcfd00466297a39174da11fbb?s=80\u0026d=identicon"
|
||||
},
|
||||
"project":{
|
||||
"name":"my-awesome-project",
|
||||
"description":"",
|
||||
"web_url":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"avatar_url":null,
|
||||
"git_ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"git_http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git",
|
||||
"namespace":"tomaszkolek0",
|
||||
"visibility_level":0,
|
||||
"path_with_namespace":"tomaszkolek0/my-awesome-project",
|
||||
"default_branch":"master",
|
||||
"homepage":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git"
|
||||
},
|
||||
"object_attributes":{
|
||||
"id":2788274,
|
||||
"title":"Issue title_new",
|
||||
"assignee_id":670043,
|
||||
"author_id":670043,
|
||||
"project_id":1534233,
|
||||
"created_at":"2016-08-18 17:47:36 UTC",
|
||||
"updated_at":"2016-08-18 18:14:13 UTC",
|
||||
"position":0,
|
||||
"branch_name":null,
|
||||
"description":"Issue description",
|
||||
"milestone_id":null,
|
||||
"state":"closed",
|
||||
"iid":1,
|
||||
"updated_by_id":670043,
|
||||
"weight":3,
|
||||
"confidential":false,
|
||||
"moved_to_id":null,
|
||||
"deleted_at":null,
|
||||
"due_date":"2016-08-01",
|
||||
"url":"https://gitlab.com/tomaszkolek0/my-awesome-project/issues/1",
|
||||
"action":"close"
|
||||
},
|
||||
"repository":{
|
||||
"name":"my-awesome-project",
|
||||
"url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"description":"",
|
||||
"homepage":"https://gitlab.com/tomaszkolek0/my-awesome-project"
|
||||
},
|
||||
"assignee":{
|
||||
"name":"Tomasz Kolek",
|
||||
"username":"tomaszkolek0",
|
||||
"avatar_url":"https://secure.gravatar.com/avatar/116a6fdbcfd00466297a39174da11fbb?s=80\u0026d=identicon"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
{
|
||||
"object_kind":"issue",
|
||||
"user":{
|
||||
"name":"Tomasz Kolek",
|
||||
"username":"tomaszkolek0",
|
||||
"avatar_url":"https://secure.gravatar.com/avatar/116a6fdbcfd00466297a39174da11fbb?s=80\u0026d=identicon"
|
||||
},
|
||||
"project":{
|
||||
"name":"my-awesome-project",
|
||||
"description":"",
|
||||
"web_url":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"avatar_url":null,
|
||||
"git_ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"git_http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git",
|
||||
"namespace":"tomaszkolek0",
|
||||
"visibility_level":0,
|
||||
"path_with_namespace":"tomaszkolek0/my-awesome-project",
|
||||
"default_branch":"master",
|
||||
"homepage":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git"
|
||||
},
|
||||
"object_attributes":{
|
||||
"id":2788274,
|
||||
"title":"Issue title",
|
||||
"assignee_id":670043,
|
||||
"author_id":670043,
|
||||
"project_id":1534233,
|
||||
"created_at":"2016-08-18 17:47:36 UTC",
|
||||
"updated_at":"2016-08-18 17:47:36 UTC",
|
||||
"position":0,
|
||||
"branch_name":null,
|
||||
"description":"Issue description",
|
||||
"milestone_id":null,
|
||||
"state":"opened",
|
||||
"iid":1,
|
||||
"updated_by_id":null,
|
||||
"weight":3,
|
||||
"confidential":false,
|
||||
"moved_to_id":null,
|
||||
"deleted_at":null,
|
||||
"due_date":"2016-08-01",
|
||||
"url":"https://gitlab.com/tomaszkolek0/my-awesome-project/issues/1",
|
||||
"action":"open"
|
||||
},
|
||||
"repository":{
|
||||
"name":"my-awesome-project",
|
||||
"url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"description":"",
|
||||
"homepage":"https://gitlab.com/tomaszkolek0/my-awesome-project"
|
||||
},
|
||||
"assignee":{
|
||||
"name":"Tomasz Kolek",
|
||||
"username":"tomaszkolek0",
|
||||
"avatar_url":"https://secure.gravatar.com/avatar/116a6fdbcfd00466297a39174da11fbb?s=80\u0026d=identicon"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
{
|
||||
"object_kind":"issue",
|
||||
"user":{
|
||||
"name":"Tomasz Kolek",
|
||||
"username":"tomaszkolek0",
|
||||
"avatar_url":"https://secure.gravatar.com/avatar/116a6fdbcfd00466297a39174da11fbb?s=80\u0026d=identicon"
|
||||
},
|
||||
"project":{
|
||||
"name":"my-awesome-project",
|
||||
"description":"",
|
||||
"web_url":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"avatar_url":null,
|
||||
"git_ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"git_http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git",
|
||||
"namespace":"tomaszkolek0",
|
||||
"visibility_level":0,
|
||||
"path_with_namespace":"tomaszkolek0/my-awesome-project",
|
||||
"default_branch":"master",
|
||||
"homepage":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git"
|
||||
},
|
||||
"object_attributes":{
|
||||
"id":2788274,
|
||||
"title":"Issue title",
|
||||
"assignee_id":670043,
|
||||
"author_id":670043,
|
||||
"project_id":1534233,
|
||||
"created_at":"2016-08-18 17:47:36 UTC",
|
||||
"updated_at":"2016-08-18 17:47:36 UTC",
|
||||
"position":0,
|
||||
"branch_name":null,
|
||||
"description":"Issue description",
|
||||
"milestone_id":null,
|
||||
"state":"opened",
|
||||
"iid":1,
|
||||
"updated_by_id":null,
|
||||
"weight":3,
|
||||
"confidential":false,
|
||||
"moved_to_id":null,
|
||||
"deleted_at":null,
|
||||
"due_date":"2016-08-01",
|
||||
"url":"https://gitlab.com/tomaszkolek0/my-awesome-project/issues/1",
|
||||
"action":"open"
|
||||
},
|
||||
"repository":{
|
||||
"name":"my-awesome-project",
|
||||
"url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"description":"",
|
||||
"homepage":"https://gitlab.com/tomaszkolek0/my-awesome-project"
|
||||
}
|
||||
}
|
||||
76
zerver/fixtures/gitlab/gitlab_issue_note.json
Normal file
76
zerver/fixtures/gitlab/gitlab_issue_note.json
Normal file
@@ -0,0 +1,76 @@
|
||||
{
|
||||
"object_kind":"note",
|
||||
"user":{
|
||||
"name":"Tomasz Kolek",
|
||||
"username":"tomaszkolek0",
|
||||
"avatar_url":"https://secure.gravatar.com/avatar/116a6fdbcfd00466297a39174da11fbb?s=80\u0026d=identicon"
|
||||
},
|
||||
"project_id":1534233,
|
||||
"project":{
|
||||
"name":"my-awesome-project",
|
||||
"description":"",
|
||||
"web_url":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"avatar_url":null,
|
||||
"git_ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"git_http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git",
|
||||
"namespace":"tomaszkolek0",
|
||||
"visibility_level":0,
|
||||
"path_with_namespace":"tomaszkolek0/my-awesome-project",
|
||||
"default_branch":"master",
|
||||
"homepage":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git"
|
||||
},
|
||||
"object_attributes":{
|
||||
"id":14172057,
|
||||
"note":"Nice issue",
|
||||
"noteable_type":"Issue",
|
||||
"author_id":670043,
|
||||
"created_at":"2016-08-22 19:46:01 UTC",
|
||||
"updated_at":"2016-08-22 19:46:01 UTC",
|
||||
"project_id":1534233,
|
||||
"attachment":null,
|
||||
"line_code":null,
|
||||
"commit_id":"",
|
||||
"noteable_id":2788403,
|
||||
"st_diff":null,
|
||||
"system":false,
|
||||
"updated_by_id":null,
|
||||
"type":null,
|
||||
"position":null,
|
||||
"original_position":null,
|
||||
"resolved_at":null,
|
||||
"resolved_by_id":null,
|
||||
"discussion_id":"3dc99fafcb44acc90c91e745626617b650b50809",
|
||||
"original_discussion_id":null,
|
||||
"url":"https://gitlab.com/tomaszkolek0/my-awesome-project/issues/2#note_14172057"
|
||||
},
|
||||
"repository":{
|
||||
"name":"my-awesome-project",
|
||||
"url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"description":"",
|
||||
"homepage":"https://gitlab.com/tomaszkolek0/my-awesome-project"
|
||||
},
|
||||
"issue":{
|
||||
"id":2788403,
|
||||
"title":"abc",
|
||||
"assignee_id":null,
|
||||
"author_id":670043,
|
||||
"project_id":1534233,
|
||||
"created_at":"2016-08-18 18:29:14 UTC",
|
||||
"updated_at":"2016-08-22 19:46:01 UTC",
|
||||
"position":0,
|
||||
"branch_name":null,
|
||||
"description":"",
|
||||
"milestone_id":null,
|
||||
"state":"opened",
|
||||
"iid":2,
|
||||
"updated_by_id":null,
|
||||
"weight":null,
|
||||
"confidential":false,
|
||||
"moved_to_id":null,
|
||||
"deleted_at":null,
|
||||
"due_date":null
|
||||
}
|
||||
}
|
||||
58
zerver/fixtures/gitlab/gitlab_issue_reopened.json
Normal file
58
zerver/fixtures/gitlab/gitlab_issue_reopened.json
Normal file
@@ -0,0 +1,58 @@
|
||||
{
|
||||
"object_kind":"issue",
|
||||
"user":{
|
||||
"name":"Tomasz Kolek",
|
||||
"username":"tomaszkolek0",
|
||||
"avatar_url":"https://secure.gravatar.com/avatar/116a6fdbcfd00466297a39174da11fbb?s=80\u0026d=identicon"
|
||||
},
|
||||
"project":{
|
||||
"name":"my-awesome-project",
|
||||
"description":"",
|
||||
"web_url":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"avatar_url":null,
|
||||
"git_ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"git_http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git",
|
||||
"namespace":"tomaszkolek0",
|
||||
"visibility_level":0,
|
||||
"path_with_namespace":"tomaszkolek0/my-awesome-project",
|
||||
"default_branch":"master",
|
||||
"homepage":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git"
|
||||
},
|
||||
"object_attributes":{
|
||||
"id":2788274,
|
||||
"title":"Issue title_new",
|
||||
"assignee_id":670043,
|
||||
"author_id":670043,
|
||||
"project_id":1534233,
|
||||
"created_at":"2016-08-18 17:47:36 UTC",
|
||||
"updated_at":"2016-08-18 18:15:07 UTC",
|
||||
"position":0,
|
||||
"branch_name":null,
|
||||
"description":"Issue description",
|
||||
"milestone_id":null,
|
||||
"state":"reopened",
|
||||
"iid":1,
|
||||
"updated_by_id":670043,
|
||||
"weight":3,
|
||||
"confidential":false,
|
||||
"moved_to_id":null,
|
||||
"deleted_at":null,
|
||||
"due_date":"2016-08-01",
|
||||
"url":"https://gitlab.com/tomaszkolek0/my-awesome-project/issues/1",
|
||||
"action":"reopen"
|
||||
},
|
||||
"repository":{
|
||||
"name":"my-awesome-project",
|
||||
"url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"description":"",
|
||||
"homepage":"https://gitlab.com/tomaszkolek0/my-awesome-project"
|
||||
},
|
||||
"assignee":{
|
||||
"name":"Tomasz Kolek",
|
||||
"username":"tomaszkolek0",
|
||||
"avatar_url":"https://secure.gravatar.com/avatar/116a6fdbcfd00466297a39174da11fbb?s=80\u0026d=identicon"
|
||||
}
|
||||
}
|
||||
58
zerver/fixtures/gitlab/gitlab_issue_updated.json
Normal file
58
zerver/fixtures/gitlab/gitlab_issue_updated.json
Normal file
@@ -0,0 +1,58 @@
|
||||
{
|
||||
"object_kind":"issue",
|
||||
"user":{
|
||||
"name":"Tomasz Kolek",
|
||||
"username":"tomaszkolek0",
|
||||
"avatar_url":"https://secure.gravatar.com/avatar/116a6fdbcfd00466297a39174da11fbb?s=80\u0026d=identicon"
|
||||
},
|
||||
"project":{
|
||||
"name":"my-awesome-project",
|
||||
"description":"",
|
||||
"web_url":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"avatar_url":null,
|
||||
"git_ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"git_http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git",
|
||||
"namespace":"tomaszkolek0",
|
||||
"visibility_level":0,
|
||||
"path_with_namespace":"tomaszkolek0/my-awesome-project",
|
||||
"default_branch":"master",
|
||||
"homepage":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git"
|
||||
},
|
||||
"object_attributes":{
|
||||
"id":2788274,
|
||||
"title":"Issue title_new",
|
||||
"assignee_id":670043,
|
||||
"author_id":670043,
|
||||
"project_id":1534233,
|
||||
"created_at":"2016-08-18 17:47:36 UTC",
|
||||
"updated_at":"2016-08-18 17:56:30 UTC",
|
||||
"position":0,
|
||||
"branch_name":null,
|
||||
"description":"Issue description",
|
||||
"milestone_id":null,
|
||||
"state":"opened",
|
||||
"iid":1,
|
||||
"updated_by_id":670043,
|
||||
"weight":3,
|
||||
"confidential":false,
|
||||
"moved_to_id":null,
|
||||
"deleted_at":null,
|
||||
"due_date":"2016-08-01",
|
||||
"url":"https://gitlab.com/tomaszkolek0/my-awesome-project/issues/1",
|
||||
"action":"update"
|
||||
},
|
||||
"repository":{
|
||||
"name":"my-awesome-project",
|
||||
"url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"description":"",
|
||||
"homepage":"https://gitlab.com/tomaszkolek0/my-awesome-project"
|
||||
},
|
||||
"assignee":{
|
||||
"name":"Tomasz Kolek",
|
||||
"username":"tomaszkolek0",
|
||||
"avatar_url":"https://secure.gravatar.com/avatar/116a6fdbcfd00466297a39174da11fbb?s=80\u0026d=identicon"
|
||||
}
|
||||
}
|
||||
112
zerver/fixtures/gitlab/gitlab_merge_request_added_commit.json
Normal file
112
zerver/fixtures/gitlab/gitlab_merge_request_added_commit.json
Normal file
@@ -0,0 +1,112 @@
|
||||
{
|
||||
"object_kind":"merge_request",
|
||||
"user":{
|
||||
"name":"Tomasz Kolek",
|
||||
"username":"tomaszkolek0",
|
||||
"avatar_url":"https://secure.gravatar.com/avatar/116a6fdbcfd00466297a39174da11fbb?s=80\u0026d=identicon"
|
||||
},
|
||||
"project":{
|
||||
"name":"my-awesome-project",
|
||||
"description":"",
|
||||
"web_url":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"avatar_url":null,
|
||||
"git_ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"git_http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git",
|
||||
"namespace":"tomaszkolek0",
|
||||
"visibility_level":0,
|
||||
"path_with_namespace":"tomaszkolek0/my-awesome-project",
|
||||
"default_branch":"master",
|
||||
"homepage":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git"
|
||||
},
|
||||
"object_attributes":{
|
||||
"id":756509,
|
||||
"target_branch":"master",
|
||||
"source_branch":"tomek",
|
||||
"source_project_id":1534233,
|
||||
"author_id":670043,
|
||||
"assignee_id":670043,
|
||||
"title":"New Merge Request",
|
||||
"created_at":"2016-08-22 20:27:22 UTC",
|
||||
"updated_at":"2016-08-22 20:33:20 UTC",
|
||||
"milestone_id":null,
|
||||
"state":"opened",
|
||||
"merge_status":"can_be_merged",
|
||||
"target_project_id":1534233,
|
||||
"iid":3,
|
||||
"description":"updated desc",
|
||||
"position":0,
|
||||
"locked_at":null,
|
||||
"updated_by_id":670043,
|
||||
"merge_error":null,
|
||||
"merge_params":{
|
||||
"force_remove_source_branch":null
|
||||
},
|
||||
"merge_when_build_succeeds":false,
|
||||
"merge_user_id":null,
|
||||
"merge_commit_sha":null,
|
||||
"deleted_at":null,
|
||||
"approvals_before_merge":null,
|
||||
"rebase_commit_sha":null,
|
||||
"in_progress_merge_commit_sha":null,
|
||||
"source":{
|
||||
"name":"my-awesome-project",
|
||||
"description":"",
|
||||
"web_url":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"avatar_url":null,
|
||||
"git_ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"git_http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git",
|
||||
"namespace":"tomaszkolek0",
|
||||
"visibility_level":0,
|
||||
"path_with_namespace":"tomaszkolek0/my-awesome-project",
|
||||
"default_branch":"master",
|
||||
"homepage":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git"
|
||||
},
|
||||
"target":{
|
||||
"name":"my-awesome-project",
|
||||
"description":"",
|
||||
"web_url":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"avatar_url":null,
|
||||
"git_ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"git_http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git",
|
||||
"namespace":"tomaszkolek0",
|
||||
"visibility_level":0,
|
||||
"path_with_namespace":"tomaszkolek0/my-awesome-project",
|
||||
"default_branch":"master",
|
||||
"homepage":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git"
|
||||
},
|
||||
"last_commit":{
|
||||
"id":"600060393d326486c12f222ba78d569dab6b4114",
|
||||
"message":"new commit\n",
|
||||
"timestamp":"2016-08-22T21:31:34+02:00",
|
||||
"url":"https://gitlab.com/tomaszkolek0/my-awesome-project/commit/600060393d326486c12f222ba78d569dab6b4114",
|
||||
"author":{
|
||||
"name":"Tomasz Kolek",
|
||||
"email":"tomasz-kolek@o2.pl"
|
||||
}
|
||||
},
|
||||
"work_in_progress":false,
|
||||
"url":"https://gitlab.com/tomaszkolek0/my-awesome-project/merge_requests/3",
|
||||
"action":"update",
|
||||
"oldrev":"600060393d326486c12f222ba78d569dab6b4114"
|
||||
},
|
||||
"repository":{
|
||||
"name":"my-awesome-project",
|
||||
"url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"description":"",
|
||||
"homepage":"https://gitlab.com/tomaszkolek0/my-awesome-project"
|
||||
},
|
||||
"assignee":{
|
||||
"name":"Tomasz Kolek",
|
||||
"username":"tomaszkolek0",
|
||||
"avatar_url":"https://secure.gravatar.com/avatar/116a6fdbcfd00466297a39174da11fbb?s=80\u0026d=identicon"
|
||||
}
|
||||
}
|
||||
106
zerver/fixtures/gitlab/gitlab_merge_request_closed.json
Normal file
106
zerver/fixtures/gitlab/gitlab_merge_request_closed.json
Normal file
@@ -0,0 +1,106 @@
|
||||
{
|
||||
"object_kind":"merge_request",
|
||||
"user":{
|
||||
"name":"Tomasz Kolek",
|
||||
"username":"tomaszkolek0",
|
||||
"avatar_url":"https://secure.gravatar.com/avatar/116a6fdbcfd00466297a39174da11fbb?s=80\u0026d=identicon"
|
||||
},
|
||||
"project":{
|
||||
"name":"my-awesome-project",
|
||||
"description":"",
|
||||
"web_url":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"avatar_url":null,
|
||||
"git_ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"git_http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git",
|
||||
"namespace":"tomaszkolek0",
|
||||
"visibility_level":0,
|
||||
"path_with_namespace":"tomaszkolek0/my-awesome-project",
|
||||
"default_branch":"master",
|
||||
"homepage":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git"
|
||||
},
|
||||
"object_attributes":{
|
||||
"id":756208,
|
||||
"target_branch":"master",
|
||||
"source_branch":"tomek",
|
||||
"source_project_id":1534233,
|
||||
"author_id":670043,
|
||||
"assignee_id":null,
|
||||
"title":"NEW MR",
|
||||
"created_at":"2016-08-22 20:08:13 UTC",
|
||||
"updated_at":"2016-08-22 20:14:21 UTC",
|
||||
"milestone_id":null,
|
||||
"state":"closed",
|
||||
"merge_status":"can_be_merged",
|
||||
"target_project_id":1534233,
|
||||
"iid":2,
|
||||
"description":"",
|
||||
"position":0,
|
||||
"locked_at":null,
|
||||
"updated_by_id":null,
|
||||
"merge_error":null,
|
||||
"merge_params":{
|
||||
"force_remove_source_branch":null
|
||||
},
|
||||
"merge_when_build_succeeds":false,
|
||||
"merge_user_id":null,
|
||||
"merge_commit_sha":null,
|
||||
"deleted_at":null,
|
||||
"approvals_before_merge":null,
|
||||
"rebase_commit_sha":null,
|
||||
"in_progress_merge_commit_sha":null,
|
||||
"source":{
|
||||
"name":"my-awesome-project",
|
||||
"description":"",
|
||||
"web_url":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"avatar_url":null,
|
||||
"git_ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"git_http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git",
|
||||
"namespace":"tomaszkolek0",
|
||||
"visibility_level":0,
|
||||
"path_with_namespace":"tomaszkolek0/my-awesome-project",
|
||||
"default_branch":"master",
|
||||
"homepage":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git"
|
||||
},
|
||||
"target":{
|
||||
"name":"my-awesome-project",
|
||||
"description":"",
|
||||
"web_url":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"avatar_url":null,
|
||||
"git_ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"git_http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git",
|
||||
"namespace":"tomaszkolek0",
|
||||
"visibility_level":0,
|
||||
"path_with_namespace":"tomaszkolek0/my-awesome-project",
|
||||
"default_branch":"master",
|
||||
"homepage":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git"
|
||||
},
|
||||
"last_commit":{
|
||||
"id":"600060393d326486c12f222ba78d569dab6b4114",
|
||||
"message":"new commit\n",
|
||||
"timestamp":"2016-08-22T21:31:34+02:00",
|
||||
"url":"https://gitlab.com/tomaszkolek0/my-awesome-project/commit/600060393d326486c12f222ba78d569dab6b4114",
|
||||
"author":{
|
||||
"name":"Tomasz Kolek",
|
||||
"email":"tomasz-kolek@o2.pl"
|
||||
}
|
||||
},
|
||||
"work_in_progress":false,
|
||||
"url":"https://gitlab.com/tomaszkolek0/my-awesome-project/merge_requests/2",
|
||||
"action":"close"
|
||||
},
|
||||
"repository":{
|
||||
"name":"my-awesome-project",
|
||||
"url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"description":"",
|
||||
"homepage":"https://gitlab.com/tomaszkolek0/my-awesome-project"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
{
|
||||
"object_kind":"merge_request",
|
||||
"user":{
|
||||
"name":"Tomasz Kolek",
|
||||
"username":"tomaszkolek0",
|
||||
"avatar_url":"https://secure.gravatar.com/avatar/116a6fdbcfd00466297a39174da11fbb?s=80\u0026d=identicon"
|
||||
},
|
||||
"project":{
|
||||
"name":"my-awesome-project",
|
||||
"description":"",
|
||||
"web_url":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"avatar_url":null,
|
||||
"git_ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"git_http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git",
|
||||
"namespace":"tomaszkolek0",
|
||||
"visibility_level":0,
|
||||
"path_with_namespace":"tomaszkolek0/my-awesome-project",
|
||||
"default_branch":"master",
|
||||
"homepage":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git"
|
||||
},
|
||||
"object_attributes":{
|
||||
"id":756509,
|
||||
"target_branch":"master",
|
||||
"source_branch":"tomek",
|
||||
"source_project_id":1534233,
|
||||
"author_id":670043,
|
||||
"assignee_id":670043,
|
||||
"title":"New Merge Request",
|
||||
"created_at":"2016-08-22 20:27:22 UTC",
|
||||
"updated_at":"2016-08-22 20:27:22 UTC",
|
||||
"milestone_id":null,
|
||||
"state":"opened",
|
||||
"merge_status":"unchecked",
|
||||
"target_project_id":1534233,
|
||||
"iid":3,
|
||||
"description":"",
|
||||
"position":0,
|
||||
"locked_at":null,
|
||||
"updated_by_id":null,
|
||||
"merge_error":null,
|
||||
"merge_params":{
|
||||
"force_remove_source_branch":null
|
||||
},
|
||||
"merge_when_build_succeeds":false,
|
||||
"merge_user_id":null,
|
||||
"merge_commit_sha":null,
|
||||
"deleted_at":null,
|
||||
"approvals_before_merge":null,
|
||||
"rebase_commit_sha":null,
|
||||
"in_progress_merge_commit_sha":null,
|
||||
"source":{
|
||||
"name":"my-awesome-project",
|
||||
"description":"",
|
||||
"web_url":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"avatar_url":null,
|
||||
"git_ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"git_http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git",
|
||||
"namespace":"tomaszkolek0",
|
||||
"visibility_level":0,
|
||||
"path_with_namespace":"tomaszkolek0/my-awesome-project",
|
||||
"default_branch":"master",
|
||||
"homepage":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git"
|
||||
},
|
||||
"target":{
|
||||
"name":"my-awesome-project",
|
||||
"description":"",
|
||||
"web_url":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"avatar_url":null,
|
||||
"git_ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"git_http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git",
|
||||
"namespace":"tomaszkolek0",
|
||||
"visibility_level":0,
|
||||
"path_with_namespace":"tomaszkolek0/my-awesome-project",
|
||||
"default_branch":"master",
|
||||
"homepage":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git"
|
||||
},
|
||||
"last_commit":{
|
||||
"id":"600060393d326486c12f222ba78d569dab6b4114",
|
||||
"message":"new commit\n",
|
||||
"timestamp":"2016-08-22T21:31:34+02:00",
|
||||
"url":"https://gitlab.com/tomaszkolek0/my-awesome-project/commit/600060393d326486c12f222ba78d569dab6b4114",
|
||||
"author":{
|
||||
"name":"Tomasz Kolek",
|
||||
"email":"tomasz-kolek@o2.pl"
|
||||
}
|
||||
},
|
||||
"work_in_progress":false,
|
||||
"url":"https://gitlab.com/tomaszkolek0/my-awesome-project/merge_requests/3",
|
||||
"action":"open"
|
||||
},
|
||||
"repository":{
|
||||
"name":"my-awesome-project",
|
||||
"url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"description":"",
|
||||
"homepage":"https://gitlab.com/tomaszkolek0/my-awesome-project"
|
||||
},
|
||||
"assignee":{
|
||||
"name":"Tomasz Kolek",
|
||||
"username":"tomaszkolek0",
|
||||
"avatar_url":"https://secure.gravatar.com/avatar/116a6fdbcfd00466297a39174da11fbb?s=80\u0026d=identicon"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
{
|
||||
"object_kind":"merge_request",
|
||||
"user":{
|
||||
"name":"Tomasz Kolek",
|
||||
"username":"tomaszkolek0",
|
||||
"avatar_url":"https://secure.gravatar.com/avatar/116a6fdbcfd00466297a39174da11fbb?s=80\u0026d=identicon"
|
||||
},
|
||||
"project":{
|
||||
"name":"my-awesome-project",
|
||||
"description":"",
|
||||
"web_url":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"avatar_url":null,
|
||||
"git_ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"git_http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git",
|
||||
"namespace":"tomaszkolek0",
|
||||
"visibility_level":0,
|
||||
"path_with_namespace":"tomaszkolek0/my-awesome-project",
|
||||
"default_branch":"master",
|
||||
"homepage":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git"
|
||||
},
|
||||
"object_attributes":{
|
||||
"id":756208,
|
||||
"target_branch":"master",
|
||||
"source_branch":"tomek",
|
||||
"source_project_id":1534233,
|
||||
"author_id":670043,
|
||||
"assignee_id":null,
|
||||
"title":"NEW MR",
|
||||
"created_at":"2016-08-22 20:08:13 UTC",
|
||||
"updated_at":"2016-08-22 20:08:13 UTC",
|
||||
"milestone_id":null,
|
||||
"state":"opened",
|
||||
"merge_status":"unchecked",
|
||||
"target_project_id":1534233,
|
||||
"iid":2,
|
||||
"description":"",
|
||||
"position":0,
|
||||
"locked_at":null,
|
||||
"updated_by_id":null,
|
||||
"merge_error":null,
|
||||
"merge_params":{
|
||||
"force_remove_source_branch":null
|
||||
},
|
||||
"merge_when_build_succeeds":false,
|
||||
"merge_user_id":null,
|
||||
"merge_commit_sha":null,
|
||||
"deleted_at":null,
|
||||
"approvals_before_merge":null,
|
||||
"rebase_commit_sha":null,
|
||||
"in_progress_merge_commit_sha":null,
|
||||
"source":{
|
||||
"name":"my-awesome-project",
|
||||
"description":"",
|
||||
"web_url":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"avatar_url":null,
|
||||
"git_ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"git_http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git",
|
||||
"namespace":"tomaszkolek0",
|
||||
"visibility_level":0,
|
||||
"path_with_namespace":"tomaszkolek0/my-awesome-project",
|
||||
"default_branch":"master",
|
||||
"homepage":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git"
|
||||
},
|
||||
"target":{
|
||||
"name":"my-awesome-project",
|
||||
"description":"",
|
||||
"web_url":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"avatar_url":null,
|
||||
"git_ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"git_http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git",
|
||||
"namespace":"tomaszkolek0",
|
||||
"visibility_level":0,
|
||||
"path_with_namespace":"tomaszkolek0/my-awesome-project",
|
||||
"default_branch":"master",
|
||||
"homepage":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git"
|
||||
},
|
||||
"last_commit":{
|
||||
"id":"600060393d326486c12f222ba78d569dab6b4114",
|
||||
"message":"new commit\n",
|
||||
"timestamp":"2016-08-22T21:31:34+02:00",
|
||||
"url":"https://gitlab.com/tomaszkolek0/my-awesome-project/commit/600060393d326486c12f222ba78d569dab6b4114",
|
||||
"author":{
|
||||
"name":"Tomasz Kolek",
|
||||
"email":"tomasz-kolek@o2.pl"
|
||||
}
|
||||
},
|
||||
"work_in_progress":false,
|
||||
"url":"https://gitlab.com/tomaszkolek0/my-awesome-project/merge_requests/2",
|
||||
"action":"open"
|
||||
},
|
||||
"repository":{
|
||||
"name":"my-awesome-project",
|
||||
"url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"description":"",
|
||||
"homepage":"https://gitlab.com/tomaszkolek0/my-awesome-project"
|
||||
}
|
||||
}
|
||||
111
zerver/fixtures/gitlab/gitlab_merge_request_merged.json
Normal file
111
zerver/fixtures/gitlab/gitlab_merge_request_merged.json
Normal file
@@ -0,0 +1,111 @@
|
||||
{
|
||||
"object_kind":"merge_request",
|
||||
"user":{
|
||||
"name":"Tomasz Kolek",
|
||||
"username":"tomaszkolek0",
|
||||
"avatar_url":"https://secure.gravatar.com/avatar/116a6fdbcfd00466297a39174da11fbb?s=80\u0026d=identicon"
|
||||
},
|
||||
"project":{
|
||||
"name":"my-awesome-project",
|
||||
"description":"",
|
||||
"web_url":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"avatar_url":null,
|
||||
"git_ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"git_http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git",
|
||||
"namespace":"tomaszkolek0",
|
||||
"visibility_level":0,
|
||||
"path_with_namespace":"tomaszkolek0/my-awesome-project",
|
||||
"default_branch":"master",
|
||||
"homepage":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git"
|
||||
},
|
||||
"object_attributes":{
|
||||
"id":756509,
|
||||
"target_branch":"master",
|
||||
"source_branch":"tomek",
|
||||
"source_project_id":1534233,
|
||||
"author_id":670043,
|
||||
"assignee_id":670043,
|
||||
"title":"New Merge Request",
|
||||
"created_at":"2016-08-22 20:27:22 UTC",
|
||||
"updated_at":"2016-08-22 20:41:06 UTC",
|
||||
"milestone_id":null,
|
||||
"state":"merged",
|
||||
"merge_status":"can_be_merged",
|
||||
"target_project_id":1534233,
|
||||
"iid":3,
|
||||
"description":"updated desc",
|
||||
"position":0,
|
||||
"locked_at":null,
|
||||
"updated_by_id":670043,
|
||||
"merge_error":null,
|
||||
"merge_params":{
|
||||
"force_remove_source_branch":null
|
||||
},
|
||||
"merge_when_build_succeeds":false,
|
||||
"merge_user_id":null,
|
||||
"merge_commit_sha":"5bcfb805534d13224e8fa7698a2819bf0d055f29",
|
||||
"deleted_at":null,
|
||||
"approvals_before_merge":null,
|
||||
"rebase_commit_sha":null,
|
||||
"in_progress_merge_commit_sha":null,
|
||||
"source":{
|
||||
"name":"my-awesome-project",
|
||||
"description":"",
|
||||
"web_url":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"avatar_url":null,
|
||||
"git_ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"git_http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git",
|
||||
"namespace":"tomaszkolek0",
|
||||
"visibility_level":0,
|
||||
"path_with_namespace":"tomaszkolek0/my-awesome-project",
|
||||
"default_branch":"master",
|
||||
"homepage":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git"
|
||||
},
|
||||
"target":{
|
||||
"name":"my-awesome-project",
|
||||
"description":"",
|
||||
"web_url":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"avatar_url":null,
|
||||
"git_ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"git_http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git",
|
||||
"namespace":"tomaszkolek0",
|
||||
"visibility_level":0,
|
||||
"path_with_namespace":"tomaszkolek0/my-awesome-project",
|
||||
"default_branch":"master",
|
||||
"homepage":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git"
|
||||
},
|
||||
"last_commit":{
|
||||
"id":"f423fe3fedbc09f64ef438bedbde12caa161ee14",
|
||||
"message":"new\n",
|
||||
"timestamp":"2016-08-22T22:34:57+02:00",
|
||||
"url":"https://gitlab.com/tomaszkolek0/my-awesome-project/commit/f423fe3fedbc09f64ef438bedbde12caa161ee14",
|
||||
"author":{
|
||||
"name":"Tomasz Kolek",
|
||||
"email":"tomasz-kolek@o2.pl"
|
||||
}
|
||||
},
|
||||
"work_in_progress":false,
|
||||
"url":"https://gitlab.com/tomaszkolek0/my-awesome-project/merge_requests/3",
|
||||
"action":"merge"
|
||||
},
|
||||
"repository":{
|
||||
"name":"my-awesome-project",
|
||||
"url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"description":"",
|
||||
"homepage":"https://gitlab.com/tomaszkolek0/my-awesome-project"
|
||||
},
|
||||
"assignee":{
|
||||
"name":"Tomasz Kolek",
|
||||
"username":"tomaszkolek0",
|
||||
"avatar_url":"https://secure.gravatar.com/avatar/116a6fdbcfd00466297a39174da11fbb?s=80\u0026d=identicon"
|
||||
}
|
||||
}
|
||||
129
zerver/fixtures/gitlab/gitlab_merge_request_note.json
Normal file
129
zerver/fixtures/gitlab/gitlab_merge_request_note.json
Normal file
@@ -0,0 +1,129 @@
|
||||
{
|
||||
"object_kind":"note",
|
||||
"user":{
|
||||
"name":"Tomasz Kolek",
|
||||
"username":"tomaszkolek0",
|
||||
"avatar_url":"https://secure.gravatar.com/avatar/116a6fdbcfd00466297a39174da11fbb?s=80\u0026d=identicon"
|
||||
},
|
||||
"project_id":1534233,
|
||||
"project":{
|
||||
"name":"my-awesome-project",
|
||||
"description":"",
|
||||
"web_url":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"avatar_url":null,
|
||||
"git_ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"git_http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git",
|
||||
"namespace":"tomaszkolek0",
|
||||
"visibility_level":0,
|
||||
"path_with_namespace":"tomaszkolek0/my-awesome-project",
|
||||
"default_branch":"master",
|
||||
"homepage":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git"
|
||||
},
|
||||
"object_attributes":{
|
||||
"id":14171860,
|
||||
"note":"Nice merge request!",
|
||||
"noteable_type":"MergeRequest",
|
||||
"author_id":670043,
|
||||
"created_at":"2016-08-22 19:36:22 UTC",
|
||||
"updated_at":"2016-08-22 19:36:22 UTC",
|
||||
"project_id":1534233,
|
||||
"attachment":null,
|
||||
"line_code":null,
|
||||
"commit_id":"",
|
||||
"noteable_id":756075,
|
||||
"st_diff":null,
|
||||
"system":false,
|
||||
"updated_by_id":null,
|
||||
"type":null,
|
||||
"position":null,
|
||||
"original_position":null,
|
||||
"resolved_at":null,
|
||||
"resolved_by_id":null,
|
||||
"discussion_id":"431b621ff2e6f4dc0e37ad19160b9e946a02f488",
|
||||
"original_discussion_id":null,
|
||||
"url":"https://gitlab.com/tomaszkolek0/my-awesome-project/merge_requests/1#note_14171860"
|
||||
},
|
||||
"repository":{
|
||||
"name":"my-awesome-project",
|
||||
"url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"description":"",
|
||||
"homepage":"https://gitlab.com/tomaszkolek0/my-awesome-project"
|
||||
},
|
||||
"merge_request":{
|
||||
"id":756075,
|
||||
"target_branch":"master",
|
||||
"source_branch":"tomek",
|
||||
"source_project_id":1534233,
|
||||
"author_id":670043,
|
||||
"assignee_id":null,
|
||||
"title":"Tomek",
|
||||
"created_at":"2016-08-22 19:36:12 UTC",
|
||||
"updated_at":"2016-08-22 19:36:22 UTC",
|
||||
"milestone_id":null,
|
||||
"state":"opened",
|
||||
"merge_status":"can_be_merged",
|
||||
"target_project_id":1534233,
|
||||
"iid":1,
|
||||
"description":"",
|
||||
"position":0,
|
||||
"locked_at":null,
|
||||
"updated_by_id":null,
|
||||
"merge_error":null,
|
||||
"merge_params":{
|
||||
"force_remove_source_branch":null
|
||||
},
|
||||
"merge_when_build_succeeds":false,
|
||||
"merge_user_id":null,
|
||||
"merge_commit_sha":null,
|
||||
"deleted_at":null,
|
||||
"approvals_before_merge":null,
|
||||
"rebase_commit_sha":null,
|
||||
"in_progress_merge_commit_sha":null,
|
||||
"source":{
|
||||
"name":"my-awesome-project",
|
||||
"description":"",
|
||||
"web_url":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"avatar_url":null,
|
||||
"git_ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"git_http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git",
|
||||
"namespace":"tomaszkolek0",
|
||||
"visibility_level":0,
|
||||
"path_with_namespace":"tomaszkolek0/my-awesome-project",
|
||||
"default_branch":"master",
|
||||
"homepage":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git"
|
||||
},
|
||||
"target":{
|
||||
"name":"my-awesome-project",
|
||||
"description":"",
|
||||
"web_url":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"avatar_url":null,
|
||||
"git_ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"git_http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git",
|
||||
"namespace":"tomaszkolek0",
|
||||
"visibility_level":0,
|
||||
"path_with_namespace":"tomaszkolek0/my-awesome-project",
|
||||
"default_branch":"master",
|
||||
"homepage":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git"
|
||||
},
|
||||
"last_commit":{
|
||||
"id":"600060393d326486c12f222ba78d569dab6b4114",
|
||||
"message":"new commit\n",
|
||||
"timestamp":"2016-08-22T21:31:34+02:00",
|
||||
"url":"https://gitlab.com/tomaszkolek0/my-awesome-project/commit/600060393d326486c12f222ba78d569dab6b4114",
|
||||
"author":{
|
||||
"name":"Tomasz Kolek",
|
||||
"email":"tomasz-kolek@o2.pl"
|
||||
}
|
||||
},
|
||||
"work_in_progress":false
|
||||
}
|
||||
}
|
||||
111
zerver/fixtures/gitlab/gitlab_merge_request_updated.json
Normal file
111
zerver/fixtures/gitlab/gitlab_merge_request_updated.json
Normal file
@@ -0,0 +1,111 @@
|
||||
{
|
||||
"object_kind":"merge_request",
|
||||
"user":{
|
||||
"name":"Tomasz Kolek",
|
||||
"username":"tomaszkolek0",
|
||||
"avatar_url":"https://secure.gravatar.com/avatar/116a6fdbcfd00466297a39174da11fbb?s=80\u0026d=identicon"
|
||||
},
|
||||
"project":{
|
||||
"name":"my-awesome-project",
|
||||
"description":"",
|
||||
"web_url":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"avatar_url":null,
|
||||
"git_ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"git_http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git",
|
||||
"namespace":"tomaszkolek0",
|
||||
"visibility_level":0,
|
||||
"path_with_namespace":"tomaszkolek0/my-awesome-project",
|
||||
"default_branch":"master",
|
||||
"homepage":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git"
|
||||
},
|
||||
"object_attributes":{
|
||||
"id":756509,
|
||||
"target_branch":"master",
|
||||
"source_branch":"tomek",
|
||||
"source_project_id":1534233,
|
||||
"author_id":670043,
|
||||
"assignee_id":670043,
|
||||
"title":"New Merge Request",
|
||||
"created_at":"2016-08-22 20:27:22 UTC",
|
||||
"updated_at":"2016-08-22 20:33:20 UTC",
|
||||
"milestone_id":null,
|
||||
"state":"opened",
|
||||
"merge_status":"can_be_merged",
|
||||
"target_project_id":1534233,
|
||||
"iid":3,
|
||||
"description":"updated desc",
|
||||
"position":0,
|
||||
"locked_at":null,
|
||||
"updated_by_id":670043,
|
||||
"merge_error":null,
|
||||
"merge_params":{
|
||||
"force_remove_source_branch":null
|
||||
},
|
||||
"merge_when_build_succeeds":false,
|
||||
"merge_user_id":null,
|
||||
"merge_commit_sha":null,
|
||||
"deleted_at":null,
|
||||
"approvals_before_merge":null,
|
||||
"rebase_commit_sha":null,
|
||||
"in_progress_merge_commit_sha":null,
|
||||
"source":{
|
||||
"name":"my-awesome-project",
|
||||
"description":"",
|
||||
"web_url":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"avatar_url":null,
|
||||
"git_ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"git_http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git",
|
||||
"namespace":"tomaszkolek0",
|
||||
"visibility_level":0,
|
||||
"path_with_namespace":"tomaszkolek0/my-awesome-project",
|
||||
"default_branch":"master",
|
||||
"homepage":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git"
|
||||
},
|
||||
"target":{
|
||||
"name":"my-awesome-project",
|
||||
"description":"",
|
||||
"web_url":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"avatar_url":null,
|
||||
"git_ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"git_http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git",
|
||||
"namespace":"tomaszkolek0",
|
||||
"visibility_level":0,
|
||||
"path_with_namespace":"tomaszkolek0/my-awesome-project",
|
||||
"default_branch":"master",
|
||||
"homepage":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git"
|
||||
},
|
||||
"last_commit":{
|
||||
"id":"600060393d326486c12f222ba78d569dab6b4114",
|
||||
"message":"new commit\n",
|
||||
"timestamp":"2016-08-22T21:31:34+02:00",
|
||||
"url":"https://gitlab.com/tomaszkolek0/my-awesome-project/commit/600060393d326486c12f222ba78d569dab6b4114",
|
||||
"author":{
|
||||
"name":"Tomasz Kolek",
|
||||
"email":"tomasz-kolek@o2.pl"
|
||||
}
|
||||
},
|
||||
"work_in_progress":false,
|
||||
"url":"https://gitlab.com/tomaszkolek0/my-awesome-project/merge_requests/3",
|
||||
"action":"update"
|
||||
},
|
||||
"repository":{
|
||||
"name":"my-awesome-project",
|
||||
"url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"description":"",
|
||||
"homepage":"https://gitlab.com/tomaszkolek0/my-awesome-project"
|
||||
},
|
||||
"assignee":{
|
||||
"name":"Tomasz Kolek",
|
||||
"username":"tomaszkolek0",
|
||||
"avatar_url":"https://secure.gravatar.com/avatar/116a6fdbcfd00466297a39174da11fbb?s=80\u0026d=identicon"
|
||||
}
|
||||
}
|
||||
80
zerver/fixtures/gitlab/gitlab_push.json
Normal file
80
zerver/fixtures/gitlab/gitlab_push.json
Normal file
@@ -0,0 +1,80 @@
|
||||
{
|
||||
"object_kind":"push",
|
||||
"event_name":"push",
|
||||
"before":"5fcdd5551fc3085df79bece2c32b1400802ac407",
|
||||
"after":"eb6ae1e591e0819dc5bf187c6bfe18ec065a80e9",
|
||||
"ref":"refs/heads/tomek",
|
||||
"checkout_sha":"eb6ae1e591e0819dc5bf187c6bfe18ec065a80e9",
|
||||
"message":null,
|
||||
"user_id":670043,
|
||||
"user_name":"Tomasz Kolek",
|
||||
"user_email":"tomaszkolek0@gmail.com",
|
||||
"user_avatar":"https://secure.gravatar.com/avatar/116a6fdbcfd00466297a39174da11fbb?s=80\u0026d=identicon",
|
||||
"project_id":1534233,
|
||||
"project":{
|
||||
"name":"my-awesome-project",
|
||||
"description":"",
|
||||
"web_url":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"avatar_url":null,
|
||||
"git_ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"git_http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git",
|
||||
"namespace":"tomaszkolek0",
|
||||
"visibility_level":0,
|
||||
"path_with_namespace":"tomaszkolek0/my-awesome-project",
|
||||
"default_branch":"master",
|
||||
"homepage":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git"
|
||||
},
|
||||
"commits":[
|
||||
{
|
||||
"id":"66abd2da28809ffa128ed0447965cf11d7f863a7",
|
||||
"message":"b\n",
|
||||
"timestamp":"2016-08-17T21:17:54+02:00",
|
||||
"url":"https://gitlab.com/tomaszkolek0/my-awesome-project/commit/66abd2da28809ffa128ed0447965cf11d7f863a7",
|
||||
"author":{
|
||||
"name":"Tomasz Kolek",
|
||||
"email":"tomasz-kolek@o2.pl"
|
||||
},
|
||||
"added":[
|
||||
|
||||
],
|
||||
"modified":[
|
||||
"a.txt"
|
||||
],
|
||||
"removed":[
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"id":"eb6ae1e591e0819dc5bf187c6bfe18ec065a80e9",
|
||||
"message":"c\n",
|
||||
"timestamp":"2016-08-17T21:18:06+02:00",
|
||||
"url":"https://gitlab.com/tomaszkolek0/my-awesome-project/commit/eb6ae1e591e0819dc5bf187c6bfe18ec065a80e9",
|
||||
"author":{
|
||||
"name":"Tomasz Kolek",
|
||||
"email":"tomasz-kolek@o2.pl"
|
||||
},
|
||||
"added":[
|
||||
|
||||
],
|
||||
"modified":[
|
||||
"a.txt"
|
||||
],
|
||||
"removed":[
|
||||
|
||||
]
|
||||
}
|
||||
],
|
||||
"total_commits_count":2,
|
||||
"repository":{
|
||||
"name":"my-awesome-project",
|
||||
"url":"git@gitlab.com:tomaszkolek/my-awesome-project.git",
|
||||
"description":"",
|
||||
"homepage":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"git_http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git",
|
||||
"git_ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"visibility_level":0
|
||||
}
|
||||
}
|
||||
43
zerver/fixtures/gitlab/gitlab_remove_tag.json
Normal file
43
zerver/fixtures/gitlab/gitlab_remove_tag.json
Normal file
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"object_kind":"tag_push",
|
||||
"event_name":"tag_push",
|
||||
"before":"0000000000000000000000000000000000000000",
|
||||
"after":"eb6ae1e591e0819dc5bf187c6bfe18ec065a80e9",
|
||||
"ref":"refs/tags/xyz",
|
||||
"checkout_sha": null,
|
||||
"message":null,
|
||||
"user_id":670043,
|
||||
"user_name":"Tomasz Kolek",
|
||||
"user_email":"tomaszkolek0@gmail.com",
|
||||
"user_avatar":"https://secure.gravatar.com/avatar/116a6fdbcfd00466297a39174da11fbb?s=80\u0026d=identicon",
|
||||
"project_id":1534233,
|
||||
"project":{
|
||||
"name":"my-awesome-project",
|
||||
"description":"",
|
||||
"web_url":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"avatar_url":null,
|
||||
"git_ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"git_http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git",
|
||||
"namespace":"tomaszkolek0",
|
||||
"visibility_level":0,
|
||||
"path_with_namespace":"tomaszkolek0/my-awesome-project",
|
||||
"default_branch":"master",
|
||||
"homepage":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git"
|
||||
},
|
||||
"commits":[
|
||||
|
||||
],
|
||||
"total_commits_count":0,
|
||||
"repository":{
|
||||
"name":"my-awesome-project",
|
||||
"url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"description":"",
|
||||
"homepage":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"git_http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git",
|
||||
"git_ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"visibility_level":0
|
||||
}
|
||||
}
|
||||
60
zerver/fixtures/gitlab/gitlab_snippet_note.json
Normal file
60
zerver/fixtures/gitlab/gitlab_snippet_note.json
Normal file
@@ -0,0 +1,60 @@
|
||||
{
|
||||
"object_kind": "note",
|
||||
"user":{
|
||||
"name":"Tomasz Kolek",
|
||||
"username":"tomaszkolek0",
|
||||
"avatar_url":"https://secure.gravatar.com/avatar/116a6fdbcfd00466297a39174da11fbb?s=80\u0026d=identicon"
|
||||
},
|
||||
"project_id": 1534233,
|
||||
"project":{
|
||||
"name":"my-awesome-project",
|
||||
"description":"",
|
||||
"web_url":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"avatar_url":null,
|
||||
"git_ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"git_http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git",
|
||||
"namespace":"tomaszkolek0",
|
||||
"visibility_level":0,
|
||||
"path_with_namespace":"tomaszkolek0/my-awesome-project",
|
||||
"default_branch":"master",
|
||||
"homepage":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git"
|
||||
},
|
||||
"repository":{
|
||||
"name":"my-awesome-project",
|
||||
"url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"description":"",
|
||||
"homepage":"https://gitlab.com/tomaszkolek0/my-awesome-project"
|
||||
},
|
||||
"object_attributes": {
|
||||
"id": 14172058,
|
||||
"note": "Nice snippet",
|
||||
"noteable_type": "Snippet",
|
||||
"author_id": 670043,
|
||||
"created_at":"2016-08-22 19:46:01 UTC",
|
||||
"updated_at":"2016-08-22 19:46:01 UTC",
|
||||
"project_id": 1534233,
|
||||
"attachment": null,
|
||||
"line_code": null,
|
||||
"commit_id": "",
|
||||
"noteable_id": 2788404,
|
||||
"system": false,
|
||||
"st_diff": null,
|
||||
"url":"https://gitlab.com/tomaszkolek0/my-awesome-project/snippets/2#note_14172058"
|
||||
},
|
||||
"snippet": {
|
||||
"id": 2,
|
||||
"title": "test",
|
||||
"content": "puts 'Hello world'",
|
||||
"author_id": 670043,
|
||||
"project_id": 1534233,
|
||||
"created_at":"2016-08-21 17:36:01 UTC",
|
||||
"updated_at":"2016-08-22 19:46:01 UTC",
|
||||
"file_name": "README.md",
|
||||
"expires_at": null,
|
||||
"type": "ProjectSnippet",
|
||||
"visibility_level": 0
|
||||
}
|
||||
}
|
||||
39
zerver/fixtures/gitlab/gitlab_wiki_page_edited.json
Normal file
39
zerver/fixtures/gitlab/gitlab_wiki_page_edited.json
Normal file
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"object_kind":"wiki_page",
|
||||
"user":{
|
||||
"name":"Tomasz Kolek",
|
||||
"username":"tomaszkolek0",
|
||||
"avatar_url":"https://secure.gravatar.com/avatar/116a6fdbcfd00466297a39174da11fbb?s=80\u0026d=identicon"
|
||||
},
|
||||
"project":{
|
||||
"name":"my-awesome-project",
|
||||
"description":"",
|
||||
"web_url":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"avatar_url":null,
|
||||
"git_ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"git_http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git",
|
||||
"namespace":"tomaszkolek0",
|
||||
"visibility_level":0,
|
||||
"path_with_namespace":"tomaszkolek0/my-awesome-project",
|
||||
"default_branch":"master",
|
||||
"homepage":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git"
|
||||
},
|
||||
"wiki":{
|
||||
"web_url":"https://gitlab.com/tomaszkolek0/my-awesome-project/wikis/home",
|
||||
"git_ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.wiki.git",
|
||||
"git_http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.wiki.git",
|
||||
"path_with_namespace":"tomaszkolek0/my-awesome-project.wiki",
|
||||
"default_branch":"master"
|
||||
},
|
||||
"object_attributes":{
|
||||
"slug":"how-to",
|
||||
"title":"how to",
|
||||
"format":"markdown",
|
||||
"content":"abcaaa",
|
||||
"url":"https://gitlab.com/tomaszkolek0/my-awesome-project/wikis/how-to",
|
||||
"action":"update"
|
||||
}
|
||||
}
|
||||
40
zerver/fixtures/gitlab/gitlab_wiki_page_opened.json
Normal file
40
zerver/fixtures/gitlab/gitlab_wiki_page_opened.json
Normal file
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"object_kind":"wiki_page",
|
||||
"user":{
|
||||
"name":"Tomasz Kolek",
|
||||
"username":"tomaszkolek0",
|
||||
"avatar_url":"https://secure.gravatar.com/avatar/116a6fdbcfd00466297a39174da11fbb?s=80\u0026d=identicon"
|
||||
},
|
||||
"project":{
|
||||
"name":"my-awesome-project",
|
||||
"description":"",
|
||||
"web_url":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"avatar_url":null,
|
||||
"git_ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"git_http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git",
|
||||
"namespace":"tomaszkolek0",
|
||||
"visibility_level":0,
|
||||
"path_with_namespace":"tomaszkolek0/my-awesome-project",
|
||||
"default_branch":"master",
|
||||
"homepage":"https://gitlab.com/tomaszkolek0/my-awesome-project",
|
||||
"url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.git",
|
||||
"http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.git"
|
||||
},
|
||||
"wiki":{
|
||||
"web_url":"https://gitlab.com/tomaszkolek0/my-awesome-project/wikis/home",
|
||||
"git_ssh_url":"git@gitlab.com:tomaszkolek0/my-awesome-project.wiki.git",
|
||||
"git_http_url":"https://gitlab.com/tomaszkolek0/my-awesome-project.wiki.git",
|
||||
"path_with_namespace":"tomaszkolek0/my-awesome-project.wiki",
|
||||
"default_branch":"master"
|
||||
},
|
||||
"object_attributes":{
|
||||
"title":"how to",
|
||||
"content":"abc",
|
||||
"format":"markdown",
|
||||
"message":"",
|
||||
"slug":"how-to",
|
||||
"url":"https://gitlab.com/tomaszkolek0/my-awesome-project/wikis/how-to",
|
||||
"action":"create"
|
||||
}
|
||||
}
|
||||
@@ -80,6 +80,7 @@ WEBHOOK_INTEGRATIONS = [
|
||||
WebhookIntegration('deskdotcom', logo='static/images/integrations/logos/deskcom.png', display_name='Desk.com'),
|
||||
WebhookIntegration('freshdesk'),
|
||||
WebhookIntegration('github', function='zerver.views.webhooks.github.api_github_landing', display_name='GitHub'),
|
||||
WebhookIntegration('gitlab', display_name='GitLab'),
|
||||
WebhookIntegration('helloworld', display_name='Hello World'),
|
||||
WebhookIntegration('ifttt', function='zerver.views.webhooks.ifttt.api_iftt_app_webhook', display_name='IFTTT'),
|
||||
WebhookIntegration('jira', secondary_line_text='(hosted or v5.2+)', display_name='JIRA'),
|
||||
|
||||
@@ -1748,3 +1748,243 @@ class HelloWorldHookTests(WebhookTestCase):
|
||||
def get_body(self, fixture_name):
|
||||
# type: (text_type) -> text_type
|
||||
return self.fixture_data("helloworld", fixture_name, file_type="json")
|
||||
|
||||
class GitlabHookTests(WebhookTestCase):
|
||||
STREAM_NAME = 'gitlab'
|
||||
URL_TEMPLATE = "/api/v1/external/gitlab?&api_key={api_key}"
|
||||
FIXTURE_DIR_NAME = 'gitlab'
|
||||
|
||||
def test_push_event_message(self):
|
||||
# type: () -> None
|
||||
expected_subject = u"Repository: my-awesome-project"
|
||||
expected_message = u"Tomasz Kolek pushed [2 commits](https://gitlab.com/tomaszkolek0/my-awesome-project/compare/5fcdd5551fc3085df79bece2c32b1400802ac407...eb6ae1e591e0819dc5bf187c6bfe18ec065a80e9) to tomek branch."
|
||||
|
||||
self.send_and_test_stream_message('push', expected_subject, expected_message, HTTP_X_GITLAB_EVENT="Push Hook")
|
||||
|
||||
def test_add_tag_event_message(self):
|
||||
# type: () -> None
|
||||
expected_subject = u"Repository: my-awesome-project"
|
||||
expected_message = u"Tomasz Kolek pushed xyz tag."
|
||||
|
||||
self.send_and_test_stream_message(
|
||||
'add_tag',
|
||||
expected_subject,
|
||||
expected_message,
|
||||
HTTP_X_GITLAB_EVENT="Tag Push Hook",
|
||||
)
|
||||
|
||||
def test_remove_tag_event_message(self):
|
||||
# type: () -> None
|
||||
expected_subject = u"Repository: my-awesome-project"
|
||||
expected_message = u"Tomasz Kolek removed xyz tag."
|
||||
|
||||
self.send_and_test_stream_message(
|
||||
'remove_tag',
|
||||
expected_subject,
|
||||
expected_message,
|
||||
HTTP_X_GITLAB_EVENT="Tag Push Hook"
|
||||
)
|
||||
|
||||
def test_create_issue_without_assignee_event_message(self):
|
||||
# type: () -> None
|
||||
expected_subject = u"Repository: my-awesome-project"
|
||||
expected_message = u"Tomasz Kolek created [Issue #1](https://gitlab.com/tomaszkolek0/my-awesome-project/issues/1)."
|
||||
|
||||
self.send_and_test_stream_message(
|
||||
'issue_created_without_assignee',
|
||||
expected_subject,
|
||||
expected_message,
|
||||
HTTP_X_GITLAB_EVENT="Issue Hook"
|
||||
)
|
||||
|
||||
def test_create_issue_with_assignee_event_message(self):
|
||||
# type: () -> None
|
||||
expected_subject = u"Repository: my-awesome-project"
|
||||
expected_message = u"Tomasz Kolek created [Issue #1](https://gitlab.com/tomaszkolek0/my-awesome-project/issues/1) (assigned to Tomasz Kolek)."
|
||||
|
||||
self.send_and_test_stream_message(
|
||||
'issue_created_with_assignee',
|
||||
expected_subject,
|
||||
expected_message,
|
||||
HTTP_X_GITLAB_EVENT="Issue Hook"
|
||||
)
|
||||
|
||||
def test_update_issue_event_message(self):
|
||||
# type: () -> None
|
||||
expected_subject = u"Repository: my-awesome-project"
|
||||
expected_message = u"Tomasz Kolek updated [Issue #1](https://gitlab.com/tomaszkolek0/my-awesome-project/issues/1)."
|
||||
|
||||
self.send_and_test_stream_message(
|
||||
'issue_updated',
|
||||
expected_subject,
|
||||
expected_message,
|
||||
HTTP_X_GITLAB_EVENT="Issue Hook"
|
||||
)
|
||||
|
||||
def test_close_issue_event_message(self):
|
||||
# type: () -> None
|
||||
expected_subject = u"Repository: my-awesome-project"
|
||||
expected_message = u"Tomasz Kolek closed [Issue #1](https://gitlab.com/tomaszkolek0/my-awesome-project/issues/1)."
|
||||
|
||||
self.send_and_test_stream_message(
|
||||
'issue_closed',
|
||||
expected_subject,
|
||||
expected_message,
|
||||
HTTP_X_GITLAB_EVENT="Issue Hook"
|
||||
)
|
||||
|
||||
def test_reopen_issue_event_message(self):
|
||||
# type: () -> None
|
||||
expected_subject = u"Repository: my-awesome-project"
|
||||
expected_message = u"Tomasz Kolek reopened [Issue #1](https://gitlab.com/tomaszkolek0/my-awesome-project/issues/1)."
|
||||
|
||||
self.send_and_test_stream_message(
|
||||
'issue_reopened',
|
||||
expected_subject,
|
||||
expected_message,
|
||||
HTTP_X_GITLAB_EVENT="Issue Hook"
|
||||
)
|
||||
|
||||
def test_note_commit_event_message(self):
|
||||
# type: () -> None
|
||||
expected_subject = u"Repository: my-awesome-project"
|
||||
expected_message = u"Tomasz Kolek added [comment](https://gitlab.com/tomaszkolek0/my-awesome-project/commit/66abd2da28809ffa128ed0447965cf11d7f863a7#note_14169211) to [Commit](https://gitlab.com/tomaszkolek0/my-awesome-project/commit/66abd2da28809ffa128ed0447965cf11d7f863a7)."
|
||||
|
||||
self.send_and_test_stream_message(
|
||||
'commit_note',
|
||||
expected_subject,
|
||||
expected_message,
|
||||
HTTP_X_GITLAB_EVENT="Note Hook"
|
||||
)
|
||||
|
||||
def test_note_merge_request_event_message(self):
|
||||
# type: () -> None
|
||||
expected_subject = u"Repository: my-awesome-project"
|
||||
expected_message = u"Tomasz Kolek added [comment](https://gitlab.com/tomaszkolek0/my-awesome-project/merge_requests/1#note_14171860) to [Merge Request #1](https://gitlab.com/tomaszkolek0/my-awesome-project/merge_requests/1)."
|
||||
|
||||
self.send_and_test_stream_message(
|
||||
'merge_request_note',
|
||||
expected_subject,
|
||||
expected_message,
|
||||
HTTP_X_GITLAB_EVENT="Note Hook"
|
||||
)
|
||||
|
||||
def test_note_issue_event_message(self):
|
||||
# type: () -> None
|
||||
expected_subject = u"Repository: my-awesome-project"
|
||||
expected_message = u"Tomasz Kolek added [comment](https://gitlab.com/tomaszkolek0/my-awesome-project/issues/2#note_14172057) to [Issue #2](https://gitlab.com/tomaszkolek0/my-awesome-project/issues/2)."
|
||||
|
||||
self.send_and_test_stream_message(
|
||||
'issue_note',
|
||||
expected_subject,
|
||||
expected_message,
|
||||
HTTP_X_GITLAB_EVENT="Note Hook"
|
||||
)
|
||||
|
||||
def test_note_snippet_event_message(self):
|
||||
# type: () -> None
|
||||
expected_subject = u"Repository: my-awesome-project"
|
||||
expected_message = u"Tomasz Kolek added [comment](https://gitlab.com/tomaszkolek0/my-awesome-project/snippets/2#note_14172058) to [Snippet #2](https://gitlab.com/tomaszkolek0/my-awesome-project/snippets/2)."
|
||||
|
||||
self.send_and_test_stream_message(
|
||||
'snippet_note',
|
||||
expected_subject,
|
||||
expected_message,
|
||||
HTTP_X_GITLAB_EVENT="Note Hook"
|
||||
)
|
||||
|
||||
def test_merge_request_created_without_assignee_event_message(self):
|
||||
# type: () -> None
|
||||
expected_subject = u"Repository: my-awesome-project"
|
||||
expected_message = u"Tomasz Kolek created [Merge Request #2](https://gitlab.com/tomaszkolek0/my-awesome-project/merge_requests/2)."
|
||||
|
||||
self.send_and_test_stream_message(
|
||||
'merge_request_created_without_assignee',
|
||||
expected_subject,
|
||||
expected_message,
|
||||
HTTP_X_GITLAB_EVENT="Merge Request Hook"
|
||||
)
|
||||
|
||||
def test_merge_request_created_with_assignee_event_message(self):
|
||||
# type: () -> None
|
||||
expected_subject = u"Repository: my-awesome-project"
|
||||
expected_message = u"Tomasz Kolek created [Merge Request #3](https://gitlab.com/tomaszkolek0/my-awesome-project/merge_requests/3) (assigned to Tomasz Kolek)."
|
||||
|
||||
self.send_and_test_stream_message(
|
||||
'merge_request_created_with_assignee',
|
||||
expected_subject,
|
||||
expected_message,
|
||||
HTTP_X_GITLAB_EVENT="Merge Request Hook"
|
||||
)
|
||||
|
||||
def test_merge_request_closed_event_message(self):
|
||||
# type: () -> None
|
||||
expected_subject = u"Repository: my-awesome-project"
|
||||
expected_message = u"Tomasz Kolek closed [Merge Request #2](https://gitlab.com/tomaszkolek0/my-awesome-project/merge_requests/2)."
|
||||
|
||||
self.send_and_test_stream_message(
|
||||
'merge_request_closed',
|
||||
expected_subject,
|
||||
expected_message,
|
||||
HTTP_X_GITLAB_EVENT="Merge Request Hook"
|
||||
)
|
||||
|
||||
def test_merge_request_updated_event_message(self):
|
||||
# type: () -> None
|
||||
expected_subject = u"Repository: my-awesome-project"
|
||||
expected_message = u"Tomasz Kolek updated [Merge Request #3](https://gitlab.com/tomaszkolek0/my-awesome-project/merge_requests/3)."
|
||||
|
||||
self.send_and_test_stream_message(
|
||||
'merge_request_updated',
|
||||
expected_subject,
|
||||
expected_message,
|
||||
HTTP_X_GITLAB_EVENT="Merge Request Hook"
|
||||
)
|
||||
|
||||
def test_merge_request_added_commit_event_message(self):
|
||||
# type: () -> None
|
||||
expected_subject = u"Repository: my-awesome-project"
|
||||
expected_message = u"Tomasz Kolek added commit to [Merge Request #3](https://gitlab.com/tomaszkolek0/my-awesome-project/merge_requests/3)."
|
||||
|
||||
self.send_and_test_stream_message(
|
||||
'merge_request_added_commit',
|
||||
expected_subject,
|
||||
expected_message,
|
||||
HTTP_X_GITLAB_EVENT="Merge Request Hook"
|
||||
)
|
||||
|
||||
def test_merge_request_merged_event_message(self):
|
||||
# type: () -> None
|
||||
expected_subject = u"Repository: my-awesome-project"
|
||||
expected_message = u"Tomasz Kolek merged [Merge Request #3](https://gitlab.com/tomaszkolek0/my-awesome-project/merge_requests/3)."
|
||||
|
||||
self.send_and_test_stream_message(
|
||||
'merge_request_merged',
|
||||
expected_subject,
|
||||
expected_message,
|
||||
HTTP_X_GITLAB_EVENT="Merge Request Hook"
|
||||
)
|
||||
|
||||
def test_wiki_page_opened_event_message(self):
|
||||
# type: () -> None
|
||||
expected_subject = u"Repository: my-awesome-project"
|
||||
expected_message = u"Tomasz Kolek created [Wiki Page \"how to\"](https://gitlab.com/tomaszkolek0/my-awesome-project/wikis/how-to)."
|
||||
|
||||
self.send_and_test_stream_message(
|
||||
'wiki_page_opened',
|
||||
expected_subject,
|
||||
expected_message,
|
||||
HTTP_X_GITLAB_EVENT="Wiki Page Hook"
|
||||
)
|
||||
|
||||
def test_wiki_page_edited_event_message(self):
|
||||
# type: () -> None
|
||||
expected_subject = u"Repository: my-awesome-project"
|
||||
expected_message = u"Tomasz Kolek updated [Wiki Page \"how to\"](https://gitlab.com/tomaszkolek0/my-awesome-project/wikis/how-to)."
|
||||
|
||||
self.send_and_test_stream_message(
|
||||
'wiki_page_edited',
|
||||
expected_subject,
|
||||
expected_message,
|
||||
HTTP_X_GITLAB_EVENT="Wiki Page Hook"
|
||||
)
|
||||
|
||||
213
zerver/views/webhooks/gitlab.py
Normal file
213
zerver/views/webhooks/gitlab.py
Normal file
@@ -0,0 +1,213 @@
|
||||
from __future__ import absolute_import
|
||||
from functools import partial
|
||||
from zerver.lib.actions import check_send_message
|
||||
from zerver.lib.response import json_success
|
||||
from zerver.decorator import api_key_only_webhook_view, REQ, has_request_variables
|
||||
from zerver.models import Client, UserProfile
|
||||
|
||||
from django.http import HttpRequest, HttpResponse
|
||||
from six import text_type
|
||||
from typing import Dict, Any, Iterable, Optional
|
||||
|
||||
|
||||
class UnknownEventType(Exception):
|
||||
pass
|
||||
|
||||
def get_push_event_body(payload):
|
||||
# type: (Dict[str, Any]) -> text_type
|
||||
total_commits_count = payload['total_commits_count']
|
||||
compare_url = u'{}/compare/{}...{}'.format(
|
||||
get_repository_homepage(payload),
|
||||
payload['before'],
|
||||
payload['after']
|
||||
)
|
||||
body = u"{} pushed [{} commit{}]({}) to {} branch.".format(
|
||||
get_user_name(payload),
|
||||
total_commits_count,
|
||||
u's' if total_commits_count > 1 else u'',
|
||||
compare_url,
|
||||
get_branch_name(payload)
|
||||
)
|
||||
return body
|
||||
|
||||
def get_tag_push_event_body(payload):
|
||||
# type: (Dict[str, Any]) -> text_type
|
||||
return u"{} {} {} tag.".format(
|
||||
get_user_name(payload),
|
||||
"pushed" if payload.get('checkout_sha') else "removed",
|
||||
get_tag_name(payload)
|
||||
)
|
||||
|
||||
def get_issue_created_event_body(payload):
|
||||
# type: (Dict[str, Any]) -> text_type
|
||||
body = get_issue_event_body(payload, "created")
|
||||
assignee_name = payload.get('assignee', {}).get('name')
|
||||
if assignee_name:
|
||||
body = u"{} (assigned to {}).".format(body[:-1], assignee_name)
|
||||
return body
|
||||
|
||||
def get_issue_event_body(payload, action):
|
||||
# type: (Dict[str, Any], text_type) -> text_type
|
||||
return "{} {} [Issue #{}]({}).".format(
|
||||
get_issue_user_name(payload),
|
||||
action,
|
||||
get_object_iid(payload),
|
||||
get_object_url(payload)
|
||||
)
|
||||
|
||||
def get_merge_request_created_event_body(payload):
|
||||
# type: (Dict[str, Any]) -> text_type
|
||||
body = get_merge_request_event_body(payload, "created")
|
||||
assignee_name = payload.get('assignee', {}).get('name')
|
||||
if assignee_name:
|
||||
body = u"{} (assigned to {}).".format(body[:-1], assignee_name)
|
||||
return body
|
||||
|
||||
def get_merge_request_updated_event_body(payload):
|
||||
# type: (Dict[str, Any]) -> text_type
|
||||
if payload.get('object_attributes').get('oldrev'):
|
||||
return get_merge_request_event_body(payload, "added commit to")
|
||||
return get_merge_request_event_body(payload, "updated")
|
||||
|
||||
def get_merge_request_event_body(payload, action):
|
||||
# type: (Dict[str, Any], text_type) -> text_type
|
||||
return u"{} {} [Merge Request #{}]({}).".format(
|
||||
get_issue_user_name(payload),
|
||||
action,
|
||||
get_object_iid(payload),
|
||||
get_object_url(payload)
|
||||
)
|
||||
|
||||
def get_commented_commit_event_body(payload):
|
||||
# type: (Dict[str, Any]) -> text_type
|
||||
return u"{} added [comment]({}) to [Commit]({}).".format(
|
||||
get_issue_user_name(payload),
|
||||
payload.get('object_attributes').get('url'),
|
||||
payload.get('commit').get('url')
|
||||
)
|
||||
|
||||
def get_commented_merge_request_event_body(payload):
|
||||
# type: (Dict[str, Any]) -> text_type
|
||||
return u"{} added [comment]({}) to [Merge Request #{}]({}/merge_requests/{}).".format(
|
||||
get_issue_user_name(payload),
|
||||
payload.get('object_attributes').get('url'),
|
||||
payload.get('merge_request').get('iid'),
|
||||
payload.get('project').get('web_url'),
|
||||
payload.get('merge_request').get('iid'),
|
||||
)
|
||||
|
||||
def get_commented_issue_event_body(payload):
|
||||
# type: (Dict[str, Any]) -> text_type
|
||||
return u"{} added [comment]({}) to [Issue #{}]({}/issues/{}).".format(
|
||||
get_issue_user_name(payload),
|
||||
payload.get('object_attributes').get('url'),
|
||||
payload.get('issue').get('iid'),
|
||||
payload.get('project').get('web_url'),
|
||||
payload.get('issue').get('iid'),
|
||||
)
|
||||
|
||||
def get_commented_snippet_event_body(payload):
|
||||
# type: (Dict[str, Any]) -> text_type
|
||||
return u"{} added [comment]({}) to [Snippet #{}]({}/snippets/{}).".format(
|
||||
get_issue_user_name(payload),
|
||||
payload.get('object_attributes').get('url'),
|
||||
payload.get('snippet').get('id'),
|
||||
payload.get('project').get('web_url'),
|
||||
payload.get('snippet').get('id'),
|
||||
)
|
||||
|
||||
def get_wiki_page_event_body(payload, action):
|
||||
# type: (Dict[str, Any], text_type) -> text_type
|
||||
return u"{} {} [Wiki Page \"{}\"]({}).".format(
|
||||
get_issue_user_name(payload),
|
||||
action,
|
||||
payload.get('object_attributes').get('title'),
|
||||
payload.get('object_attributes').get('url'),
|
||||
)
|
||||
|
||||
def get_repo_name(payload):
|
||||
# type: (Dict[str, Any]) -> text_type
|
||||
return payload['project']['name']
|
||||
|
||||
def get_user_name(payload):
|
||||
# type: (Dict[str, Any]) -> text_type
|
||||
return payload['user_name']
|
||||
|
||||
def get_issue_user_name(payload):
|
||||
# type: (Dict[str, Any]) -> text_type
|
||||
return payload['user']['name']
|
||||
|
||||
def get_repository_homepage(payload):
|
||||
# type: (Dict[str, Any]) -> text_type
|
||||
return payload['repository']['homepage']
|
||||
|
||||
def get_branch_name(payload):
|
||||
# type: (Dict[str, Any]) -> text_type
|
||||
return payload['ref'].lstrip('refs/heads/')
|
||||
|
||||
def get_tag_name(payload):
|
||||
# type: (Dict[str, Any]) -> text_type
|
||||
return payload['ref'].lstrip('refs/tags/')
|
||||
|
||||
def get_object_iid(payload):
|
||||
# type: (Dict[str, Any]) -> text_type
|
||||
return payload['object_attributes']['iid']
|
||||
|
||||
def get_object_url(payload):
|
||||
# type: (Dict[str, Any]) -> text_type
|
||||
return payload['object_attributes']['url']
|
||||
|
||||
EVENT_FUNCTION_MAPPER = {
|
||||
'Push Hook': get_push_event_body,
|
||||
'Tag Push Hook': get_tag_push_event_body,
|
||||
'Issue Hook open': get_issue_created_event_body,
|
||||
'Issue Hook close': partial(get_issue_event_body, action='closed'),
|
||||
'Issue Hook reopen': partial(get_issue_event_body, action='reopened'),
|
||||
'Issue Hook update': partial(get_issue_event_body, action='updated'),
|
||||
'Note Hook Commit': get_commented_commit_event_body,
|
||||
'Note Hook MergeRequest': get_commented_merge_request_event_body,
|
||||
'Note Hook Issue': get_commented_issue_event_body,
|
||||
'Note Hook Snippet': get_commented_snippet_event_body,
|
||||
'Merge Request Hook open': get_merge_request_created_event_body,
|
||||
'Merge Request Hook update': get_merge_request_updated_event_body,
|
||||
'Merge Request Hook merge': partial(get_merge_request_event_body, action='merged'),
|
||||
'Merge Request Hook close': partial(get_merge_request_event_body, action='closed'),
|
||||
'Wiki Page Hook create': partial(get_wiki_page_event_body, action='created'),
|
||||
'Wiki Page Hook update': partial(get_wiki_page_event_body, action='updated'),
|
||||
}
|
||||
|
||||
@api_key_only_webhook_view("Gitlab")
|
||||
@has_request_variables
|
||||
def api_gitlab_webhook(request, user_profile, client,
|
||||
stream=REQ(default='gitlab'),
|
||||
payload=REQ(argument_type='body')):
|
||||
# type: (HttpRequest, UserProfile, Client, text_type, Dict[str, Any]) -> HttpResponse
|
||||
event = get_event(request, payload)
|
||||
body = get_body_based_on_event(event)(payload)
|
||||
subject = "Repository: {}".format(get_repo_name(payload))
|
||||
check_send_message(user_profile, client, 'stream', [stream], subject, body)
|
||||
return json_success()
|
||||
|
||||
def get_body_based_on_event(event):
|
||||
# type: (str) -> Any
|
||||
return EVENT_FUNCTION_MAPPER[event]
|
||||
|
||||
def get_event(request, payload):
|
||||
# type: (HttpRequest, Dict[str, Any]) -> str
|
||||
event = request.META['HTTP_X_GITLAB_EVENT']
|
||||
if event == 'Issue Hook':
|
||||
action = payload.get('object_attributes').get('action')
|
||||
event = "{} {}".format(event, action)
|
||||
elif event == 'Note Hook':
|
||||
action = payload.get('object_attributes').get('noteable_type')
|
||||
event = "{} {}".format(event, action)
|
||||
elif event == 'Merge Request Hook':
|
||||
action = payload.get('object_attributes').get('action')
|
||||
event = "{} {}".format(event, action)
|
||||
elif event == 'Wiki Page Hook':
|
||||
action = payload.get('object_attributes').get('action')
|
||||
event = "{} {}".format(event, action)
|
||||
|
||||
if event in list(EVENT_FUNCTION_MAPPER.keys()):
|
||||
return event
|
||||
raise UnknownEventType(u'Event {} is unknown and cannot be handled'.format(event))
|
||||
Reference in New Issue
Block a user