gitlab 3.6.1 → 3.7.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.
- data/.travis.yml +2 -0
- data/CHANGELOG.md +25 -0
- data/README.md +9 -2
- data/gitlab.gemspec +5 -1
- data/lib/gitlab.rb +3 -2
- data/lib/gitlab/cli_helpers.rb +8 -3
- data/lib/gitlab/client.rb +6 -0
- data/lib/gitlab/client/build_triggers.rb +51 -0
- data/lib/gitlab/client/build_variables.rb +66 -0
- data/lib/gitlab/client/builds.rb +106 -0
- data/lib/gitlab/client/commits.rb +5 -5
- data/lib/gitlab/client/groups.rb +36 -3
- data/lib/gitlab/client/issues.rb +16 -3
- data/lib/gitlab/client/labels.rb +2 -2
- data/lib/gitlab/client/merge_requests.rb +49 -8
- data/lib/gitlab/client/milestones.rb +1 -1
- data/lib/gitlab/client/notes.rb +28 -1
- data/lib/gitlab/client/projects.rb +60 -7
- data/lib/gitlab/client/repositories.rb +1 -32
- data/lib/gitlab/client/runners.rb +115 -0
- data/lib/gitlab/client/services.rb +48 -0
- data/lib/gitlab/client/snippets.rb +2 -2
- data/lib/gitlab/client/tags.rb +96 -0
- data/lib/gitlab/client/users.rb +72 -2
- data/lib/gitlab/error.rb +53 -10
- data/lib/gitlab/file_response.rb +45 -0
- data/lib/gitlab/help.rb +1 -0
- data/lib/gitlab/objectified_hash.rb +1 -1
- data/lib/gitlab/paginated_response.rb +2 -2
- data/lib/gitlab/request.rb +13 -34
- data/lib/gitlab/version.rb +1 -1
- data/spec/fixtures/build.json +38 -0
- data/spec/fixtures/build_artifacts.json +0 -0
- data/spec/fixtures/build_cancel.json +24 -0
- data/spec/fixtures/build_erase.json +24 -0
- data/spec/fixtures/build_retry.json +24 -0
- data/spec/fixtures/builds.json +78 -0
- data/spec/fixtures/builds_commits.json +64 -0
- data/spec/fixtures/error_project_not_found.json +1 -0
- data/spec/fixtures/git_hook.json +1 -0
- data/spec/fixtures/group_delete.json +1 -0
- data/spec/fixtures/group_member_edit.json +1 -0
- data/spec/fixtures/group_projects.json +44 -0
- data/spec/fixtures/merge_request_commits.json +1 -0
- data/spec/fixtures/project_runner_enable.json +7 -0
- data/spec/fixtures/project_runners.json +16 -0
- data/spec/fixtures/release_create.json +1 -0
- data/spec/fixtures/release_update.json +1 -0
- data/spec/fixtures/runner.json +26 -0
- data/spec/fixtures/runner_delete.json +7 -0
- data/spec/fixtures/runner_edit.json +26 -0
- data/spec/fixtures/runners.json +16 -0
- data/spec/fixtures/runners_all.json +30 -0
- data/spec/fixtures/service.json +1 -0
- data/spec/fixtures/tag.json +1 -0
- data/spec/fixtures/tag_create.json +1 -0
- data/spec/fixtures/tag_create_with_description.json +1 -0
- data/spec/fixtures/tag_delete.json +1 -0
- data/spec/fixtures/tags.json +1 -0
- data/spec/fixtures/trigger.json +7 -0
- data/spec/fixtures/triggers.json +16 -0
- data/spec/fixtures/user_email.json +1 -0
- data/spec/fixtures/user_emails.json +1 -0
- data/spec/fixtures/user_search.json +1 -0
- data/spec/fixtures/variable.json +4 -0
- data/spec/fixtures/variables.json +10 -0
- data/spec/gitlab/client/build_triggers_spec.rb +67 -0
- data/spec/gitlab/client/build_variables_spec.rb +86 -0
- data/spec/gitlab/client/builds_spec.rb +148 -0
- data/spec/gitlab/client/groups_spec.rb +51 -0
- data/spec/gitlab/client/issues_spec.rb +16 -0
- data/spec/gitlab/client/merge_requests_spec.rb +27 -4
- data/spec/gitlab/client/notes_spec.rb +32 -0
- data/spec/gitlab/client/projects_spec.rb +79 -0
- data/spec/gitlab/client/runners_spec.rb +185 -0
- data/spec/gitlab/client/services_spec.rb +55 -0
- data/spec/gitlab/client/tags_spec.rb +109 -0
- data/spec/gitlab/client/users_spec.rb +136 -0
- data/spec/gitlab/error_spec.rb +45 -0
- data/spec/gitlab/file_response_spec.rb +28 -0
- data/spec/gitlab/help_spec.rb +6 -1
- data/spec/gitlab/request_spec.rb +0 -27
- data/spec/gitlab/shell_spec.rb +1 -1
- data/spec/spec_helper.rb +2 -2
- metadata +131 -23
- checksums.yaml +0 -7
data/lib/gitlab/client/issues.rb
CHANGED
@@ -8,7 +8,7 @@ class Gitlab::Client
|
|
8
8
|
# @example
|
9
9
|
# Gitlab.issues
|
10
10
|
# Gitlab.issues(5)
|
11
|
-
# Gitlab.issues(:
|
11
|
+
# Gitlab.issues({ per_page: 40 })
|
12
12
|
#
|
13
13
|
# @param [Integer] project The ID of a project.
|
14
14
|
# @param [Hash] options A customizable set of options.
|
@@ -39,7 +39,7 @@ class Gitlab::Client
|
|
39
39
|
#
|
40
40
|
# @example
|
41
41
|
# Gitlab.create_issue(5, 'New issue')
|
42
|
-
# Gitlab.create_issue(5, 'New issue', :
|
42
|
+
# Gitlab.create_issue(5, 'New issue', { description: 'This is a new issue', assignee_id: 42 })
|
43
43
|
#
|
44
44
|
# @param [Integer] project The ID of a project.
|
45
45
|
# @param [String] title The title of an issue.
|
@@ -57,7 +57,7 @@ class Gitlab::Client
|
|
57
57
|
# Updates an issue.
|
58
58
|
#
|
59
59
|
# @example
|
60
|
-
# Gitlab.edit_issue(6, 1, :
|
60
|
+
# Gitlab.edit_issue(6, 1, { title: 'Updated title' })
|
61
61
|
#
|
62
62
|
# @param [Integer] project The ID of a project.
|
63
63
|
# @param [Integer] id The ID of an issue.
|
@@ -96,5 +96,18 @@ class Gitlab::Client
|
|
96
96
|
def reopen_issue(project, id)
|
97
97
|
put("/projects/#{project}/issues/#{id}", body: { state_event: 'reopen' })
|
98
98
|
end
|
99
|
+
|
100
|
+
# Deletes an issue.
|
101
|
+
# Only for admins and project owners
|
102
|
+
#
|
103
|
+
# @example
|
104
|
+
# Gitlab.delete_issue(3, 42)
|
105
|
+
#
|
106
|
+
# @param [Integer] project The ID of a project.
|
107
|
+
# @param [Integer] id The ID of an issue.
|
108
|
+
# @return [Gitlab::ObjectifiedHash] Information about deleted issue.
|
109
|
+
def delete_issue(project, id)
|
110
|
+
delete("/projects/#{project}/issues/#{id}")
|
111
|
+
end
|
99
112
|
end
|
100
113
|
end
|
data/lib/gitlab/client/labels.rb
CHANGED
@@ -29,8 +29,8 @@ class Gitlab::Client
|
|
29
29
|
# Updates a label.
|
30
30
|
#
|
31
31
|
# @example
|
32
|
-
# Gitlab.edit_label(42, "Backlog", :
|
33
|
-
# Gitlab.edit_label(42, "Backlog", :
|
32
|
+
# Gitlab.edit_label(42, "Backlog", { new_name: 'TODO' })
|
33
|
+
# Gitlab.edit_label(42, "Backlog", { new_name: 'TODO', color: '#DD10AA' })
|
34
34
|
#
|
35
35
|
# @param [Integer] project The ID of a project.
|
36
36
|
# @param [String] name The name of a label.
|
@@ -6,7 +6,7 @@ class Gitlab::Client
|
|
6
6
|
#
|
7
7
|
# @example
|
8
8
|
# Gitlab.merge_requests(5)
|
9
|
-
# Gitlab.merge_requests(:
|
9
|
+
# Gitlab.merge_requests({ per_page: 40 })
|
10
10
|
#
|
11
11
|
# @param [Integer] project The ID of a project.
|
12
12
|
# @param [Hash] options A customizable set of options.
|
@@ -33,9 +33,9 @@ class Gitlab::Client
|
|
33
33
|
#
|
34
34
|
# @example
|
35
35
|
# Gitlab.create_merge_request(5, 'New merge request',
|
36
|
-
# :
|
36
|
+
# { source_branch: 'source_branch', target_branch: 'target_branch' })
|
37
37
|
# Gitlab.create_merge_request(5, 'New merge request',
|
38
|
-
# :
|
38
|
+
# { source_branch: 'source_branch', target_branch: 'target_branch', assignee_id: 42 })
|
39
39
|
#
|
40
40
|
# @param [Integer] project The ID of a project.
|
41
41
|
# @param [String] title The title of a merge request.
|
@@ -53,7 +53,7 @@ class Gitlab::Client
|
|
53
53
|
# Updates a merge request.
|
54
54
|
#
|
55
55
|
# @example
|
56
|
-
# Gitlab.update_merge_request(5, 42, :
|
56
|
+
# Gitlab.update_merge_request(5, 42, { title: 'New title' })
|
57
57
|
#
|
58
58
|
# @param [Integer] project The ID of a project.
|
59
59
|
# @param [Integer] id The ID of a merge request.
|
@@ -71,7 +71,7 @@ class Gitlab::Client
|
|
71
71
|
# Accepts a merge request.
|
72
72
|
#
|
73
73
|
# @example
|
74
|
-
# Gitlab.accept_merge_request(5, 42, :
|
74
|
+
# Gitlab.accept_merge_request(5, 42, { merge_commit_message: 'Nice!' })
|
75
75
|
#
|
76
76
|
# @param [Integer] project The ID of a project.
|
77
77
|
# @param [Integer] id The ID of a merge request.
|
@@ -93,14 +93,43 @@ class Gitlab::Client
|
|
93
93
|
# @param [String] note The content of a comment.
|
94
94
|
# @return [Gitlab::ObjectifiedHash] Information about created merge request comment.
|
95
95
|
def create_merge_request_comment(project, id, note)
|
96
|
-
post("/projects/#{project}/
|
96
|
+
post("/projects/#{project}/merge_requests/#{id}/notes", body: { body: note })
|
97
97
|
end
|
98
98
|
|
99
|
+
# Adds a comment to a merge request.
|
100
|
+
#
|
101
|
+
# @example
|
102
|
+
# Gitlab.edit_merge_request_comment(5, 1,2, "Awesome merge!")
|
103
|
+
# Gitlab.edit_merge_request_comment('gitlab', 1, 2, "Awesome merge!")
|
104
|
+
#
|
105
|
+
# @param [Integer] project The ID of a project.
|
106
|
+
# @param [Integer] id The ID of a merge request.
|
107
|
+
# @param [Integer] id The ID of the merge-request comment
|
108
|
+
# @param [String] note The content of a comment.
|
109
|
+
# @return [Gitlab::ObjectifiedHash] Information about created merge request comment.
|
110
|
+
def edit_merge_request_comment(project, id, note_id , note)
|
111
|
+
put("/projects/#{project}/merge_requests/#{id}/notes/#{note_id}", body: { body: note })
|
112
|
+
end
|
113
|
+
|
114
|
+
# Deletes a comment from a merge request.
|
115
|
+
#
|
116
|
+
# @example
|
117
|
+
# Gitlab.delete_merge_request_comment(5, 1,2)
|
118
|
+
# Gitlab.delete_merge_request_comment('gitlab', 1, 2)
|
119
|
+
#
|
120
|
+
# @param [Integer] project The ID of a project.
|
121
|
+
# @param [Integer] id The ID of a merge request.
|
122
|
+
# @param [Integer] id The ID of the merge-request comment
|
123
|
+
# @return [Gitlab::ObjectifiedHash] Information about created merge request comment.
|
124
|
+
def delete_merge_request_comment(project, id, note_id)
|
125
|
+
delete("/projects/#{project}/merge_requests/#{id}/notes/#{note_id}")
|
126
|
+
end
|
127
|
+
|
99
128
|
# Gets the comments on a merge request.
|
100
129
|
#
|
101
130
|
# @example
|
102
131
|
# Gitlab.merge_request_comments(5, 1)
|
103
|
-
# Gitlab.merge_request_comments(5, 1, :
|
132
|
+
# Gitlab.merge_request_comments(5, 1, { per_page: 10, page: 2 })
|
104
133
|
#
|
105
134
|
# @param [Integer] project The ID of a project.
|
106
135
|
# @param [Integer] id The ID of a merge request.
|
@@ -109,7 +138,7 @@ class Gitlab::Client
|
|
109
138
|
# @option options [Integer] :per_page The number of results per page.
|
110
139
|
# @return [Gitlab::ObjectifiedHash] The merge request's comments.
|
111
140
|
def merge_request_comments(project, id, options={})
|
112
|
-
get("/projects/#{project}/
|
141
|
+
get("/projects/#{project}/merge_requests/#{id}/notes", query: options)
|
113
142
|
end
|
114
143
|
|
115
144
|
# Gets the changes of a merge request.
|
@@ -123,5 +152,17 @@ class Gitlab::Client
|
|
123
152
|
def merge_request_changes(project, id)
|
124
153
|
get("/projects/#{project}/merge_request/#{id}/changes")
|
125
154
|
end
|
155
|
+
|
156
|
+
# Gets the commits of a merge request.
|
157
|
+
#
|
158
|
+
# @example
|
159
|
+
# Gitlab.merge_request_commits(5, 1)
|
160
|
+
#
|
161
|
+
# @param [Integer] project The ID of a project.
|
162
|
+
# @param [Integer] id The ID of a merge request.
|
163
|
+
# @return [Array<Gitlab::ObjectifiedHash>] The merge request's commits.
|
164
|
+
def merge_request_commits(project, id)
|
165
|
+
get("/projects/#{project}/merge_request/#{id}/commits")
|
166
|
+
end
|
126
167
|
end
|
127
168
|
end
|
@@ -61,7 +61,7 @@ class Gitlab::Client
|
|
61
61
|
# Updates a milestone.
|
62
62
|
#
|
63
63
|
# @example
|
64
|
-
# Gitlab.edit_milestone(5, 2, :
|
64
|
+
# Gitlab.edit_milestone(5, 2, { state_event: 'activate' })
|
65
65
|
#
|
66
66
|
# @param [Integer] project The ID of a project.
|
67
67
|
# @param [Integer] id The ID of a milestone.
|
data/lib/gitlab/client/notes.rb
CHANGED
@@ -43,6 +43,20 @@ class Gitlab::Client
|
|
43
43
|
get("/projects/#{project}/snippets/#{snippet}/notes", query: options)
|
44
44
|
end
|
45
45
|
|
46
|
+
# Gets a list of notes for a merge request.
|
47
|
+
#
|
48
|
+
# @example
|
49
|
+
# Gitlab.merge_request_notes(5, 1)
|
50
|
+
#
|
51
|
+
# @param [Integer] project The ID of a project.
|
52
|
+
# @param [Integer] merge_request The ID of a merge request.
|
53
|
+
# @option options [Integer] :page The page number.
|
54
|
+
# @option options [Integer] :per_page The number of results per page.
|
55
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
56
|
+
def merge_request_notes(project, merge_request, options={})
|
57
|
+
get("/projects/#{project}/merge_requests/#{merge_request}/notes", query: options)
|
58
|
+
end
|
59
|
+
|
46
60
|
# Gets a single wall note.
|
47
61
|
#
|
48
62
|
# @example
|
@@ -75,12 +89,25 @@ class Gitlab::Client
|
|
75
89
|
#
|
76
90
|
# @param [Integer] project The ID of a project.
|
77
91
|
# @param [Integer] snippet The ID of a snippet.
|
78
|
-
# @param [Integer] id The ID of
|
92
|
+
# @param [Integer] id The ID of a note.
|
79
93
|
# @return [Gitlab::ObjectifiedHash]
|
80
94
|
def snippet_note(project, snippet, id)
|
81
95
|
get("/projects/#{project}/snippets/#{snippet}/notes/#{id}")
|
82
96
|
end
|
83
97
|
|
98
|
+
# Gets a single merge_request note.
|
99
|
+
#
|
100
|
+
# @example
|
101
|
+
# Gitlab.merge_request_note(5, 11, 3)
|
102
|
+
#
|
103
|
+
# @param [Integer] project The ID of a project.
|
104
|
+
# @param [Integer] merge_request The ID of a merge_request.
|
105
|
+
# @param [Integer] id The ID of a note.
|
106
|
+
# @return [Gitlab::ObjectifiedHash]
|
107
|
+
def merge_request_note(project, merge_request, id)
|
108
|
+
get("/projects/#{project}/merge_requests/#{merge_request}/notes/#{id}")
|
109
|
+
end
|
110
|
+
|
84
111
|
# Creates a new wall note.
|
85
112
|
#
|
86
113
|
# @example
|
@@ -24,8 +24,8 @@ class Gitlab::Client
|
|
24
24
|
#
|
25
25
|
# @example
|
26
26
|
# Gitlab.project_search('gitlab')
|
27
|
-
# Gitlab.project_search('gitlab', order_by: 'last_activity_at')
|
28
|
-
# Gitlab.search_projects('gitlab', order_by: 'name', sort: 'asc')
|
27
|
+
# Gitlab.project_search('gitlab', { order_by: 'last_activity_at' })
|
28
|
+
# Gitlab.search_projects('gitlab', { order_by: 'name', sort: 'asc' })
|
29
29
|
#
|
30
30
|
# @param [Hash] options A customizable set of options.
|
31
31
|
# @option options [String] :per_page Number of projects to return per page
|
@@ -69,14 +69,13 @@ class Gitlab::Client
|
|
69
69
|
#
|
70
70
|
# @example
|
71
71
|
# Gitlab.create_project('gitlab')
|
72
|
-
# Gitlab.create_project('viking', :
|
73
|
-
# Gitlab.create_project('Red', :
|
72
|
+
# Gitlab.create_project('viking', { description: 'Awesome project' })
|
73
|
+
# Gitlab.create_project('Red', { wall_enabled: false })
|
74
74
|
#
|
75
75
|
# @param [String] name The name of a project.
|
76
76
|
# @param [Hash] options A customizable set of options.
|
77
77
|
# @option options [String] :description The description of a project.
|
78
78
|
# @option options [String] :default_branch The default branch of a project.
|
79
|
-
# @option options [String] :group_id The group in which to create a project.
|
80
79
|
# @option options [String] :namespace_id The namespace in which to create a project.
|
81
80
|
# @option options [Boolean] :wiki_enabled The wiki integration for a project (0 = false, 1 = true).
|
82
81
|
# @option options [Boolean] :wall_enabled The wall functionality for a project (0 = false, 1 = true).
|
@@ -248,6 +247,60 @@ class Gitlab::Client
|
|
248
247
|
delete("/projects/#{project}/hooks/#{id}")
|
249
248
|
end
|
250
249
|
|
250
|
+
# Gets a project git hook.
|
251
|
+
# See: http://docs.gitlab.com/ee/api/projects.html#show-project-git-hooks
|
252
|
+
#
|
253
|
+
# @example
|
254
|
+
# Gitlab.git_hook(42)
|
255
|
+
#
|
256
|
+
# @param [Integer] id The ID of a project.
|
257
|
+
# @return [Gitlab::ObjectifiedHash]
|
258
|
+
def git_hook(id)
|
259
|
+
get("/projects/#{id}/git_hook")
|
260
|
+
end
|
261
|
+
|
262
|
+
# Adds a project git hook.
|
263
|
+
# See: http://docs.gitlab.com/ee/api/projects.html#add-project-git-hook
|
264
|
+
#
|
265
|
+
# @example
|
266
|
+
# Gitlab.add_git_hook(42, { deny_delete_tag: false, commit_message_regex: '\\b[A-Z]{3}-[0-9]+\\b' })
|
267
|
+
#
|
268
|
+
# @param [Integer] id The ID of a project.
|
269
|
+
# @param [Hash] options A customizable set of options.
|
270
|
+
# @param option [Boolean] :deny_delete_tag Do not allow users to remove git tags with git push (0 = false, 1 = true)
|
271
|
+
# @param option [String] :commit_message_regex Commit message regex
|
272
|
+
# @return [Gitlab::ObjectifiedHash] Information about added git hook.
|
273
|
+
def add_git_hook(id, options={})
|
274
|
+
post("/projects/#{id}/git_hook", body: options)
|
275
|
+
end
|
276
|
+
|
277
|
+
# Updates a project git hook.
|
278
|
+
# See: http://docs.gitlab.com/ee/api/projects.html#edit-project-git-hook
|
279
|
+
#
|
280
|
+
# @example
|
281
|
+
# Gitlab.edit_git_hook(42, { deny_delete_tag: false, commit_message_regex: '\\b[A-Z]{3}-[0-9]+\\b' })
|
282
|
+
#
|
283
|
+
# @param [Integer] id The ID of a project.
|
284
|
+
# @param [Hash] options A customizable set of options.
|
285
|
+
# @param option [Boolean] :deny_delete_tag Do not allow users to remove git tags with git push (0 = false, 1 = true)
|
286
|
+
# @param option [String] :commit_message_regex Commit message regex
|
287
|
+
# @return [Gitlab::ObjectifiedHash] Information about updated git hook.
|
288
|
+
def edit_git_hook(id, options={})
|
289
|
+
put("/projects/#{id}/git_hook", body: options)
|
290
|
+
end
|
291
|
+
|
292
|
+
# Deletes a git hook from a project.
|
293
|
+
# See: http://docs.gitlab.com/ee/api/projects.html#delete-project-git-hook
|
294
|
+
#
|
295
|
+
# @example
|
296
|
+
# Gitlab.delete_git_hook(42)
|
297
|
+
#
|
298
|
+
# @param [Integer] id The ID of a project.
|
299
|
+
# @return [Gitlab::ObjectifiedHash] Information about deleted git hook.
|
300
|
+
def delete_git_hook(id, options={})
|
301
|
+
delete("/projects/#{id}/git_hook")
|
302
|
+
end
|
303
|
+
|
251
304
|
# Mark this project as forked from the other
|
252
305
|
#
|
253
306
|
# @example
|
@@ -327,7 +380,7 @@ class Gitlab::Client
|
|
327
380
|
#
|
328
381
|
# @example
|
329
382
|
# Gitlab.create_fork(42)
|
330
|
-
# Gitlab.create_fork(42, :
|
383
|
+
# Gitlab.create_fork(42, { sudo: 'another_username' })
|
331
384
|
#
|
332
385
|
# @param [Integer] project The ID of a project.
|
333
386
|
# @param [Hash] options A customizable set of options.
|
@@ -341,7 +394,7 @@ class Gitlab::Client
|
|
341
394
|
#
|
342
395
|
# @example
|
343
396
|
# Gitlab.edit_project(42)
|
344
|
-
# Gitlab.edit_project(42, :
|
397
|
+
# Gitlab.edit_project(42, { name: 'project_name' })
|
345
398
|
#
|
346
399
|
# @param [Integer] project The ID of a project.
|
347
400
|
# @param [Hash] options A customizable set of options.
|
@@ -2,37 +2,6 @@ class Gitlab::Client
|
|
2
2
|
# Defines methods related to repositories.
|
3
3
|
# @see https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/repositories.md
|
4
4
|
module Repositories
|
5
|
-
# Gets a list of project repository tags.
|
6
|
-
#
|
7
|
-
# @example
|
8
|
-
# Gitlab.tags(42)
|
9
|
-
#
|
10
|
-
# @param [Integer] project The ID of a project.
|
11
|
-
# @param [Hash] options A customizable set of options.
|
12
|
-
# @option options [Integer] :page The page number.
|
13
|
-
# @option options [Integer] :per_page The number of results per page.
|
14
|
-
# @return [Array<Gitlab::ObjectifiedHash>]
|
15
|
-
def tags(project, options={})
|
16
|
-
get("/projects/#{project}/repository/tags", query: options)
|
17
|
-
end
|
18
|
-
alias_method :repo_tags, :tags
|
19
|
-
|
20
|
-
# Creates a new project repository tag.
|
21
|
-
#
|
22
|
-
# @example
|
23
|
-
# Gitlab.create_tag(42, 'new_tag', 'master')
|
24
|
-
# Gitlab.create_tag(42, 'v1.0', 'master', 'Release 1.0')
|
25
|
-
#
|
26
|
-
# @param [Integer] project The ID of a project.
|
27
|
-
# @param [String] tag_name The name of the new tag.
|
28
|
-
# @param [String] ref The ref (commit sha, branch name, or another tag) the tag will point to.
|
29
|
-
# @param [String] message Optional message for tag, creates annotated tag if specified.
|
30
|
-
# @return [Gitlab::ObjectifiedHash]
|
31
|
-
def create_tag(project, tag_name, ref, message='')
|
32
|
-
post("/projects/#{project}/repository/tags", body: { tag_name: tag_name, ref: ref, message: message })
|
33
|
-
end
|
34
|
-
alias_method :repo_create_tag, :create_tag
|
35
|
-
|
36
5
|
# Get the contents of a file
|
37
6
|
#
|
38
7
|
# @example
|
@@ -56,7 +25,7 @@ class Gitlab::Client
|
|
56
25
|
#
|
57
26
|
# @example
|
58
27
|
# Gitlab.tree(42)
|
59
|
-
# Gitlab.tree(42, path:
|
28
|
+
# Gitlab.tree(42, { path: 'Gemfile' })
|
60
29
|
#
|
61
30
|
# @param [Integer] project The ID of a project.
|
62
31
|
# @param [Hash] options A customizable set of options.
|
@@ -0,0 +1,115 @@
|
|
1
|
+
class Gitlab::Client
|
2
|
+
# Defines methods related to runners.
|
3
|
+
# @see https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/runners.md
|
4
|
+
module Runners
|
5
|
+
|
6
|
+
# Get a list of specific runners available to the user.
|
7
|
+
# Full runner params documentation: https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/runners.md
|
8
|
+
#
|
9
|
+
# @example
|
10
|
+
# Gitlab.runners
|
11
|
+
# Gitlab.runners(:active)
|
12
|
+
# Gitlab.runners(:paused)
|
13
|
+
#
|
14
|
+
# @param [Hash] options A customizable set of options.
|
15
|
+
# @option options [String] :scope The scope of specific runners to show, one of: active, paused, online; showing all runners if none provided
|
16
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
17
|
+
def runners(options = {})
|
18
|
+
get("/runners", query: options)
|
19
|
+
end
|
20
|
+
|
21
|
+
# Get a list of all runners in the GitLab instance (specific and shared). Access is restricted to users with admin privileges.
|
22
|
+
# Full runner params documentation: https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/runners.md
|
23
|
+
#
|
24
|
+
# @example
|
25
|
+
# Gitlab.all_runners
|
26
|
+
#
|
27
|
+
# @param [Hash] options A customizable set of options.
|
28
|
+
# @option options [String] :scope The scope of runners to show, one of: specific, shared, active, paused, online; showing all runners if none provided
|
29
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
30
|
+
def all_runners(options = {})
|
31
|
+
get("/runners/all", query: options)
|
32
|
+
end
|
33
|
+
|
34
|
+
# Get details of a runner..
|
35
|
+
# Full runner params documentation: https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/runners.md
|
36
|
+
#
|
37
|
+
# @example
|
38
|
+
# Gitlab.runner(42)
|
39
|
+
#
|
40
|
+
# @param [Integer, String] id The ID of a runner
|
41
|
+
# @return <Gitlab::ObjectifiedHash>
|
42
|
+
def runner(id)
|
43
|
+
get("/runners/#{id}")
|
44
|
+
end
|
45
|
+
|
46
|
+
# Update details of a runner.
|
47
|
+
# Full runner params documentation: https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/runners.md
|
48
|
+
#
|
49
|
+
# @example
|
50
|
+
# Gitlab.update_runner(42, { description: 'Awesome runner' })
|
51
|
+
# Gitlab.update_runner(42, { active: false })
|
52
|
+
# Gitlab.update_runner(42, { tag_list: [ 'awesome', 'runner' ] })
|
53
|
+
#
|
54
|
+
# @param [Integer, String] id The ID of a runner
|
55
|
+
# @param [Hash] options A customizable set of options.
|
56
|
+
# @option options [String] :active The state of a runner; can be set to true or false.
|
57
|
+
# @option options [String] :tag_list The list of tags for a runner; put array of tags, that should be finally assigned to a runner
|
58
|
+
# @return <Gitlab::ObjectifiedHash>
|
59
|
+
def update_runner(id, options={})
|
60
|
+
put("/runners/#{id}", query: options)
|
61
|
+
end
|
62
|
+
|
63
|
+
# Remove a runner.
|
64
|
+
# Full runner params documentation: https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/runners.md
|
65
|
+
#
|
66
|
+
# @example
|
67
|
+
# Gitlab.delete_runner(42)
|
68
|
+
#
|
69
|
+
# @param [Integer, String] id The ID of a runner
|
70
|
+
# @return <Gitlab::ObjectifiedHash>
|
71
|
+
def delete_runner(id)
|
72
|
+
delete("/runners/#{id}")
|
73
|
+
end
|
74
|
+
|
75
|
+
# List all runners (specific and shared) available in the project. Shared runners are listed if at least one shared runner is defined and shared runners usage is enabled in the project's settings.
|
76
|
+
# Full runner params documentation: https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/runners.md
|
77
|
+
#
|
78
|
+
# @example
|
79
|
+
# Gitlab.project_runners(42)
|
80
|
+
#
|
81
|
+
# @param [Integer, String] id The ID of a project.
|
82
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
83
|
+
def project_runners(project_id)
|
84
|
+
get("/projects/#{project_id}/runners")
|
85
|
+
end
|
86
|
+
|
87
|
+
# Enable an available specific runner in the project.
|
88
|
+
# Full runner params documentation: https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/runners.md
|
89
|
+
#
|
90
|
+
# @example
|
91
|
+
# Gitlab.project_enable_runner(2, 42)
|
92
|
+
#
|
93
|
+
# @param [Integer, String] id The ID of a project.
|
94
|
+
# @param [Integer, String] id The ID of a runner.
|
95
|
+
# @return <Gitlab::ObjectifiedHash>
|
96
|
+
def project_enable_runner(project_id, id)
|
97
|
+
body = { runner_id: id }
|
98
|
+
post("/projects/#{project_id}/runners", body: body)
|
99
|
+
end
|
100
|
+
|
101
|
+
# Disable a specific runner from the project. It works only if the project isn't the only project associated with the specified runner.
|
102
|
+
# Full runner params documentation: https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/runners.md
|
103
|
+
#
|
104
|
+
# @example
|
105
|
+
# Gitlab.project_disable_runner(2, 42)
|
106
|
+
#
|
107
|
+
# @param [Integer, String] id The ID of a project.
|
108
|
+
# @param [Integer, String] runner_id The ID of a runner.
|
109
|
+
# @return <Gitlab::ObjectifiedHash>
|
110
|
+
def project_disable_runner(id, runner_id)
|
111
|
+
delete("/projects/#{id}/runners/#{runner_id}")
|
112
|
+
end
|
113
|
+
|
114
|
+
end
|
115
|
+
end
|