gitlab 4.3.0 → 4.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/.dockerignore +6 -0
  3. data/.travis.yml +1 -1
  4. data/Dockerfile +8 -0
  5. data/README.md +64 -0
  6. data/docker-compose.yml +19 -0
  7. data/docker.env +2 -0
  8. data/gitlab.gemspec +4 -4
  9. data/lib/gitlab/client.rb +4 -0
  10. data/lib/gitlab/client/access_requests.rb +94 -0
  11. data/lib/gitlab/client/branches.rb +3 -3
  12. data/lib/gitlab/client/commits.rb +18 -0
  13. data/lib/gitlab/client/events.rb +58 -0
  14. data/lib/gitlab/client/group_milestones.rb +93 -0
  15. data/lib/gitlab/client/groups.rb +11 -11
  16. data/lib/gitlab/client/labels.rb +2 -2
  17. data/lib/gitlab/client/merge_requests.rb +129 -1
  18. data/lib/gitlab/client/notes.rb +21 -4
  19. data/lib/gitlab/client/projects.rb +37 -15
  20. data/lib/gitlab/client/runners.rb +11 -0
  21. data/lib/gitlab/client/sidekiq.rb +37 -0
  22. data/lib/gitlab/client/snippets.rb +3 -1
  23. data/lib/gitlab/client/tags.rb +5 -5
  24. data/lib/gitlab/version.rb +1 -1
  25. data/spec/fixtures/access_request.json +8 -0
  26. data/spec/fixtures/access_requests.json +18 -0
  27. data/spec/fixtures/approved_access_request.json +8 -0
  28. data/spec/fixtures/default_approved_access_request.json +8 -0
  29. data/spec/fixtures/group_milestone.json +1 -0
  30. data/spec/fixtures/group_milestone_issues.json +1 -0
  31. data/spec/fixtures/group_milestone_merge_requests.json +1 -0
  32. data/spec/fixtures/group_milestones.json +1 -0
  33. data/spec/fixtures/merge_request_discussion.json +39 -0
  34. data/spec/fixtures/merge_request_discussion_note.json +33 -0
  35. data/spec/fixtures/merge_request_discussions.json +41 -0
  36. data/spec/fixtures/project_commit_merge_requests.json +1 -0
  37. data/spec/fixtures/project_events.json +81 -1
  38. data/spec/fixtures/project_forks.json +50 -0
  39. data/spec/fixtures/runner_jobs.json +63 -0
  40. data/spec/fixtures/sidekiq_compound_metrics.json +36 -0
  41. data/spec/fixtures/sidekiq_job_stats.json +7 -0
  42. data/spec/fixtures/sidekiq_process_metrics.json +25 -0
  43. data/spec/fixtures/sidekiq_queue_metrics.json +8 -0
  44. data/spec/fixtures/user_contribution_events.json +101 -0
  45. data/spec/fixtures/user_events.json +40 -0
  46. data/spec/fixtures/user_projects.json +153 -0
  47. data/spec/gitlab/client/access_requests_spec.rb +141 -0
  48. data/spec/gitlab/client/branches_spec.rb +4 -2
  49. data/spec/gitlab/client/commits_spec.rb +22 -0
  50. data/spec/gitlab/client/events_spec.rb +48 -0
  51. data/spec/gitlab/client/group_milestones_spec.rb +98 -0
  52. data/spec/gitlab/client/merge_requests_spec.rb +127 -0
  53. data/spec/gitlab/client/notes_spec.rb +4 -4
  54. data/spec/gitlab/client/projects_spec.rb +37 -20
  55. data/spec/gitlab/client/runners_spec.rb +10 -0
  56. data/spec/gitlab/client/sidekiq_spec.rb +64 -0
  57. data/spec/gitlab/client/snippets_spec.rb +2 -2
  58. data/spec/gitlab/client/tags_spec.rb +44 -0
  59. data/spec/gitlab/shell_spec.rb +1 -1
  60. metadata +67 -7
@@ -0,0 +1,7 @@
1
+ {
2
+ "jobs": {
3
+ "processed": 2,
4
+ "failed": 0,
5
+ "enqueued": 0
6
+ }
7
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "processes": [
3
+ {
4
+ "hostname": "gitlab.example.com",
5
+ "pid": 5649,
6
+ "tag": "gitlab",
7
+ "started_at": "2016-06-14T10:45:07.159-05:00",
8
+ "queues": [
9
+ "post_receive",
10
+ "mailers",
11
+ "archive_repo",
12
+ "system_hook",
13
+ "project_web_hook",
14
+ "gitlab_shell",
15
+ "incoming_email",
16
+ "runner",
17
+ "common",
18
+ "default"
19
+ ],
20
+ "labels": [],
21
+ "concurrency": 25,
22
+ "busy": 0
23
+ }
24
+ ]
25
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "queues": {
3
+ "default": {
4
+ "backlog": 0,
5
+ "latency": 0
6
+ }
7
+ }
8
+ }
@@ -0,0 +1,101 @@
1
+ [
2
+ {
3
+ "title": null,
4
+ "project_id": 15,
5
+ "action_name": "closed",
6
+ "target_id": 830,
7
+ "target_type": "Issue",
8
+ "author_id": 1,
9
+ "target_title": "Public project search field",
10
+ "author": {
11
+ "name": "Dmitriy Zaporozhets",
12
+ "username": "root",
13
+ "id": 1,
14
+ "state": "active",
15
+ "avatar_url": "http://localhost:3000/uploads/user/avatar/1/fox_avatar.png",
16
+ "web_url": "http://localhost:3000/root"
17
+ },
18
+ "author_username": "root"
19
+ },
20
+ {
21
+ "title": null,
22
+ "project_id": 15,
23
+ "action_name": "pushed",
24
+ "target_id": null,
25
+ "target_type": null,
26
+ "author_id": 1,
27
+ "author": {
28
+ "name": "Dmitriy Zaporozhets",
29
+ "username": "root",
30
+ "id": 1,
31
+ "state": "active",
32
+ "avatar_url": "http://localhost:3000/uploads/user/avatar/1/fox_avatar.png",
33
+ "web_url": "http://localhost:3000/root"
34
+ },
35
+ "author_username": "john",
36
+ "push_data": {
37
+ "commit_count": 1,
38
+ "action": "pushed",
39
+ "ref_type": "branch",
40
+ "commit_from": "50d4420237a9de7be1304607147aec22e4a14af7",
41
+ "commit_to": "c5feabde2d8cd023215af4d2ceeb7a64839fc428",
42
+ "ref": "master",
43
+ "commit_title": "Add simple search to projects in public area"
44
+ },
45
+ "target_title": null
46
+ },
47
+ {
48
+ "title": null,
49
+ "project_id": 15,
50
+ "action_name": "closed",
51
+ "target_id": 840,
52
+ "target_type": "Issue",
53
+ "author_id": 1,
54
+ "target_title": "Finish & merge Code search PR",
55
+ "author": {
56
+ "name": "Dmitriy Zaporozhets",
57
+ "username": "root",
58
+ "id": 1,
59
+ "state": "active",
60
+ "avatar_url": "http://localhost:3000/uploads/user/avatar/1/fox_avatar.png",
61
+ "web_url": "http://localhost:3000/root"
62
+ },
63
+ "author_username": "root"
64
+ },
65
+ {
66
+ "title": null,
67
+ "project_id": 15,
68
+ "action_name": "commented on",
69
+ "target_id": 1312,
70
+ "target_type": "Note",
71
+ "author_id": 1,
72
+ "target_title": null,
73
+ "created_at": "2015-12-04T10:33:58.089Z",
74
+ "note": {
75
+ "id": 1312,
76
+ "body": "What an awesome day!",
77
+ "attachment": null,
78
+ "author": {
79
+ "name": "Dmitriy Zaporozhets",
80
+ "username": "root",
81
+ "id": 1,
82
+ "state": "active",
83
+ "avatar_url": "http://localhost:3000/uploads/user/avatar/1/fox_avatar.png",
84
+ "web_url": "http://localhost:3000/root"
85
+ },
86
+ "created_at": "2015-12-04T10:33:56.698Z",
87
+ "system": false,
88
+ "noteable_id": 377,
89
+ "noteable_type": "Issue"
90
+ },
91
+ "author": {
92
+ "name": "Dmitriy Zaporozhets",
93
+ "username": "root",
94
+ "id": 1,
95
+ "state": "active",
96
+ "avatar_url": "http://localhost:3000/uploads/user/avatar/1/fox_avatar.png",
97
+ "web_url": "http://localhost:3000/root"
98
+ },
99
+ "author_username": "root"
100
+ }
101
+ ]
@@ -0,0 +1,40 @@
1
+ [
2
+ {
3
+ "title":null,
4
+ "project_id":1,
5
+ "action_name":"opened",
6
+ "target_id":160,
7
+ "target_type":"Issue",
8
+ "author_id":25,
9
+ "target_title":"Qui natus eos odio tempore et quaerat consequuntur ducimus cupiditate quis.",
10
+ "created_at":"2017-02-09T10:43:19.667Z",
11
+ "author":{
12
+ "name":"User 3",
13
+ "username":"user3",
14
+ "id":25,
15
+ "state":"active",
16
+ "avatar_url":"http://www.gravatar.com/avatar/97d6d9441ff85fdc730e02a6068d267b?s=80\u0026d=identicon",
17
+ "web_url":"https://gitlab.example.com/user3"
18
+ },
19
+ "author_username":"user3"
20
+ },
21
+ {
22
+ "title":null,
23
+ "project_id":1,
24
+ "action_name":"opened",
25
+ "target_id":159,
26
+ "target_type":"Issue",
27
+ "author_id":21,
28
+ "target_title":"Nostrum enim non et sed optio illo deleniti non.",
29
+ "created_at":"2017-02-09T10:43:19.426Z",
30
+ "author":{
31
+ "name":"Test User",
32
+ "username":"ted",
33
+ "id":21,
34
+ "state":"active",
35
+ "avatar_url":"http://www.gravatar.com/avatar/80fb888c9a48b9a3f87477214acaa63f?s=80\u0026d=identicon",
36
+ "web_url":"https://gitlab.example.com/ted"
37
+ },
38
+ "author_username":"ted"
39
+ }
40
+ ]
@@ -0,0 +1,153 @@
1
+ [
2
+ {
3
+ "id": 1,
4
+ "description": null,
5
+ "default_branch": "master",
6
+ "visibility": "private",
7
+ "ssh_url_to_repo": "git@example.com:diaspora/diaspora-client.git",
8
+ "http_url_to_repo": "http://example.com/diaspora/diaspora-client.git",
9
+ "web_url": "http://example.com/diaspora/diaspora-client",
10
+ "tag_list": [
11
+ "example",
12
+ "disapora client"
13
+ ],
14
+ "owner": {
15
+ "id": 1,
16
+ "name": "Diaspora",
17
+ "created_at": "2013-09-30T13:46:02Z"
18
+ },
19
+ "name": "Diaspora Client",
20
+ "name_with_namespace": "Diaspora / Diaspora Client",
21
+ "path": "diaspora-client",
22
+ "path_with_namespace": "diaspora/diaspora-client",
23
+ "issues_enabled": true,
24
+ "open_issues_count": 1,
25
+ "merge_requests_enabled": true,
26
+ "jobs_enabled": true,
27
+ "wiki_enabled": true,
28
+ "snippets_enabled": false,
29
+ "resolve_outdated_diff_discussions": false,
30
+ "container_registry_enabled": false,
31
+ "created_at": "2013-09-30T13:46:02Z",
32
+ "last_activity_at": "2013-09-30T13:46:02Z",
33
+ "creator_id": 3,
34
+ "namespace": {
35
+ "id": 3,
36
+ "name": "Diaspora",
37
+ "path": "diaspora",
38
+ "kind": "group",
39
+ "full_path": "diaspora"
40
+ },
41
+ "import_status": "none",
42
+ "archived": false,
43
+ "avatar_url": "http://example.com/uploads/project/avatar/4/uploads/avatar.png",
44
+ "shared_runners_enabled": true,
45
+ "forks_count": 0,
46
+ "star_count": 0,
47
+ "runners_token": "b8547b1dc37721d05889db52fa2f02",
48
+ "public_jobs": true,
49
+ "shared_with_groups": [
50
+
51
+ ],
52
+ "only_allow_merge_if_pipeline_succeeds": false,
53
+ "only_allow_merge_if_all_discussions_are_resolved": false,
54
+ "request_access_enabled": false,
55
+ "statistics": {
56
+ "commit_count": 37,
57
+ "storage_size": 1038090,
58
+ "repository_size": 1038090,
59
+ "lfs_objects_size": 0,
60
+ "job_artifacts_size": 0
61
+ },
62
+ "_links": {
63
+ "self": "http://example.com/api/v4/projects",
64
+ "issues": "http://example.com/api/v4/projects/1/issues",
65
+ "merge_requests": "http://example.com/api/v4/projects/1/merge_requests",
66
+ "repo_branches": "http://example.com/api/v4/projects/1/repository_branches",
67
+ "labels": "http://example.com/api/v4/projects/1/labels",
68
+ "events": "http://example.com/api/v4/projects/1/events",
69
+ "members": "http://example.com/api/v4/projects/1/members"
70
+ }
71
+ },
72
+ {
73
+ "id": 6,
74
+ "description": null,
75
+ "default_branch": "master",
76
+ "visibility": "private",
77
+ "ssh_url_to_repo": "git@example.com:brightbox/puppet.git",
78
+ "http_url_to_repo": "http://example.com/brightbox/puppet.git",
79
+ "web_url": "http://example.com/brightbox/puppet",
80
+ "tag_list": [
81
+ "example",
82
+ "puppet"
83
+ ],
84
+ "owner": {
85
+ "id": 1,
86
+ "name": "Brightbox",
87
+ "created_at": "2013-09-30T13:46:02Z"
88
+ },
89
+ "name": "Puppet",
90
+ "name_with_namespace": "Brightbox / Puppet",
91
+ "path": "puppet",
92
+ "path_with_namespace": "brightbox/puppet",
93
+ "issues_enabled": true,
94
+ "open_issues_count": 1,
95
+ "merge_requests_enabled": true,
96
+ "jobs_enabled": true,
97
+ "wiki_enabled": true,
98
+ "snippets_enabled": false,
99
+ "resolve_outdated_diff_discussions": false,
100
+ "container_registry_enabled": false,
101
+ "created_at": "2013-09-30T13:46:02Z",
102
+ "last_activity_at": "2013-09-30T13:46:02Z",
103
+ "creator_id": 3,
104
+ "namespace": {
105
+ "id": 4,
106
+ "name": "Brightbox",
107
+ "path": "brightbox",
108
+ "kind": "group",
109
+ "full_path": "brightbox"
110
+ },
111
+ "import_status": "none",
112
+ "import_error": null,
113
+ "permissions": {
114
+ "project_access": {
115
+ "access_level": 10,
116
+ "notification_level": 3
117
+ },
118
+ "group_access": {
119
+ "access_level": 50,
120
+ "notification_level": 3
121
+ }
122
+ },
123
+ "archived": false,
124
+ "avatar_url": null,
125
+ "shared_runners_enabled": true,
126
+ "forks_count": 0,
127
+ "star_count": 0,
128
+ "runners_token": "b8547b1dc37721d05889db52fa2f02",
129
+ "public_jobs": true,
130
+ "shared_with_groups": [
131
+
132
+ ],
133
+ "only_allow_merge_if_pipeline_succeeds": false,
134
+ "only_allow_merge_if_all_discussions_are_resolved": false,
135
+ "request_access_enabled": false,
136
+ "statistics": {
137
+ "commit_count": 12,
138
+ "storage_size": 2066080,
139
+ "repository_size": 2066080,
140
+ "lfs_objects_size": 0,
141
+ "job_artifacts_size": 0
142
+ },
143
+ "_links": {
144
+ "self": "http://example.com/api/v4/projects",
145
+ "issues": "http://example.com/api/v4/projects/1/issues",
146
+ "merge_requests": "http://example.com/api/v4/projects/1/merge_requests",
147
+ "repo_branches": "http://example.com/api/v4/projects/1/repository_branches",
148
+ "labels": "http://example.com/api/v4/projects/1/labels",
149
+ "events": "http://example.com/api/v4/projects/1/events",
150
+ "members": "http://example.com/api/v4/projects/1/members"
151
+ }
152
+ }
153
+ ]
@@ -0,0 +1,141 @@
1
+ require 'spec_helper'
2
+
3
+ describe Gitlab::Client do
4
+ describe '.project_access_requests' do
5
+ before do
6
+ stub_get("/projects/1/access_requests", "access_requests")
7
+ @access_requests = Gitlab.project_access_requests(1)
8
+ end
9
+
10
+ it 'gets the correct resources' do
11
+ expect(a_get("/projects/1/access_requests")).to have_been_made
12
+ end
13
+
14
+ it 'returns a paginated response of project access requests' do
15
+ expect(@access_requests).to be_a Gitlab::PaginatedResponse
16
+ end
17
+ end
18
+
19
+ describe '.group_access_requests' do
20
+ before do
21
+ stub_get("/groups/1/access_requests", "access_requests")
22
+ @access_requests = Gitlab.group_access_requests(1)
23
+ end
24
+
25
+ it 'gets the correct resources' do
26
+ expect(a_get("/groups/1/access_requests")).to have_been_made
27
+ end
28
+
29
+ it 'returns a paginated response of group access requests' do
30
+ expect(@access_requests).to be_a Gitlab::PaginatedResponse
31
+ end
32
+ end
33
+
34
+ describe '.request_project_access' do
35
+ before do
36
+ stub_post("/projects/1/access_requests", "access_request")
37
+ @access_request = Gitlab.request_project_access(1)
38
+ end
39
+
40
+ it 'gets the correct resource' do
41
+ expect(a_post("/projects/1/access_requests")).to have_been_made
42
+ end
43
+ end
44
+
45
+ describe '.request_group_access' do
46
+ before do
47
+ stub_post("/groups/1/access_requests", "access_request")
48
+ @access_request = Gitlab.request_group_access(1)
49
+ end
50
+
51
+ it 'gets the correct resource' do
52
+ expect(a_post("/groups/1/access_requests")).to have_been_made
53
+ end
54
+ end
55
+
56
+ describe '.approve_project_access_request' do
57
+ context 'When no access level is given' do
58
+ before do
59
+ stub_put("/projects/1/access_requests/1/approve", "default_approved_access_request")
60
+ @access_request = Gitlab.approve_project_access_request(1, 1)
61
+ end
62
+
63
+ it 'gets the correct resource' do
64
+ expect(a_put("/projects/1/access_requests/1/approve")).to have_been_made
65
+ end
66
+
67
+ it "returns information about the project access request" do
68
+ expect(@access_request.access_level).to eq(30)
69
+ end
70
+ end
71
+ context 'When access level is given' do
72
+ before do
73
+ stub_put("/projects/1/access_requests/1/approve", "approved_access_request").with(body: {access_level: '20'})
74
+ @access_request = Gitlab.approve_project_access_request(1, 1, {access_level: '20'})
75
+ end
76
+
77
+ it 'gets the correct resource' do
78
+ expect(a_put("/projects/1/access_requests/1/approve").
79
+ with(body: { access_level: "20" })).to have_been_made
80
+ end
81
+
82
+ it "returns information about the project access request" do
83
+ expect(@access_request.access_level).to eq(20)
84
+ end
85
+ end
86
+ end
87
+
88
+ describe '.approve_group_access_request' do
89
+ context 'When no access level is given' do
90
+ before do
91
+ stub_put("/groups/1/access_requests/1/approve", "default_approved_access_request")
92
+ @access_request = Gitlab.approve_group_access_request(1, 1)
93
+ end
94
+
95
+ it 'gets the correct resource' do
96
+ expect(a_put("/groups/1/access_requests/1/approve")).to have_been_made
97
+ end
98
+
99
+ it "returns information about the group access request" do
100
+ expect(@access_request.access_level).to eq(30)
101
+ end
102
+ end
103
+ context 'When access level is given' do
104
+ before do
105
+ stub_put("/groups/1/access_requests/1/approve", "approved_access_request").with(body: {access_level: '20'})
106
+ @access_request = Gitlab.approve_group_access_request(1, 1, {access_level: '20'})
107
+ end
108
+
109
+ it 'gets the correct resource' do
110
+ expect(a_put("/groups/1/access_requests/1/approve").
111
+ with(body: { access_level: "20" })).to have_been_made
112
+ end
113
+
114
+ it "returns information about the group access request" do
115
+ expect(@access_request.access_level).to eq(20)
116
+ end
117
+ end
118
+ end
119
+
120
+ describe '.deny_project_access_request' do
121
+ before do
122
+ stub_delete("/projects/1/access_requests/1", "access_request")
123
+ @access_request = Gitlab.deny_project_access_request(1, 1)
124
+ end
125
+
126
+ it 'gets the correct resource' do
127
+ expect(a_delete("/projects/1/access_requests/1")).to have_been_made
128
+ end
129
+ end
130
+
131
+ describe '.deny_group_access_request' do
132
+ before do
133
+ stub_delete("/groups/1/access_requests/1", "access_request")
134
+ @access_request = Gitlab.deny_group_access_request(1, 1)
135
+ end
136
+
137
+ it 'gets the correct resource' do
138
+ expect(a_delete("/groups/1/access_requests/1")).to have_been_made
139
+ end
140
+ end
141
+ end