gitlab 4.12.0 → 4.20.1
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.
- checksums.yaml +4 -4
- data/LICENSE.txt +1 -1
- data/README.md +24 -16
- data/lib/gitlab/api.rb +2 -0
- data/lib/gitlab/cli.rb +6 -5
- data/lib/gitlab/cli_helpers.rb +10 -16
- data/lib/gitlab/client/build_variables.rb +17 -12
- data/lib/gitlab/client/commits.rb +42 -5
- data/lib/gitlab/client/container_registry.rb +1 -1
- data/lib/gitlab/client/epic_issues.rb +23 -0
- data/lib/gitlab/client/epics.rb +73 -0
- data/lib/gitlab/client/group_badges.rb +88 -0
- data/lib/gitlab/client/group_labels.rb +1 -1
- data/lib/gitlab/client/groups.rb +247 -2
- data/lib/gitlab/client/issue_links.rb +48 -0
- data/lib/gitlab/client/issues.rb +12 -1
- data/lib/gitlab/client/jobs.rb +91 -8
- data/lib/gitlab/client/keys.rb +11 -0
- data/lib/gitlab/client/labels.rb +1 -1
- data/lib/gitlab/client/merge_request_approvals.rb +155 -2
- data/lib/gitlab/client/merge_requests.rb +76 -4
- data/lib/gitlab/client/merge_trains.rb +55 -0
- data/lib/gitlab/client/notes.rb +27 -0
- data/lib/gitlab/client/packages.rb +95 -0
- data/lib/gitlab/client/pipeline_schedules.rb +16 -4
- data/lib/gitlab/client/pipelines.rb +37 -0
- data/lib/gitlab/client/project_exports.rb +54 -0
- data/lib/gitlab/client/project_releases.rb +11 -0
- data/lib/gitlab/client/projects.rb +119 -7
- data/lib/gitlab/client/remote_mirrors.rb +51 -0
- data/lib/gitlab/client/repositories.rb +56 -1
- data/lib/gitlab/client/repository_files.rb +16 -0
- data/lib/gitlab/client/resource_state_events.rb +57 -0
- data/lib/gitlab/client/runners.rb +126 -21
- data/lib/gitlab/client/search.rb +5 -1
- data/lib/gitlab/client/user_snippets.rb +114 -0
- data/lib/gitlab/client/users.rb +267 -12
- data/lib/gitlab/client.rb +16 -2
- data/lib/gitlab/configuration.rb +1 -1
- data/lib/gitlab/error.rb +36 -1
- data/lib/gitlab/headers/page_links.rb +37 -0
- data/lib/gitlab/headers/total.rb +29 -0
- data/lib/gitlab/help.rb +8 -8
- data/lib/gitlab/objectified_hash.rb +23 -7
- data/lib/gitlab/paginated_response.rb +29 -40
- data/lib/gitlab/request.rb +35 -21
- data/lib/gitlab/shell_history.rb +2 -2
- data/lib/gitlab/version.rb +1 -1
- data/lib/gitlab.rb +17 -6
- metadata +24 -48
- data/lib/gitlab/page_links.rb +0 -35
data/lib/gitlab/client/groups.rb
CHANGED
|
@@ -24,9 +24,12 @@ class Gitlab::Client
|
|
|
24
24
|
# Gitlab.group(42)
|
|
25
25
|
#
|
|
26
26
|
# @param [Integer] id The ID of a group.
|
|
27
|
+
# @param [Hash] options A customizable set of options.
|
|
28
|
+
# @option options [Boolean] :with_custom_attributes Include custom attributes in response (admins only)
|
|
29
|
+
# @option options [Boolean] :with_projects Include details about group projects (default: true)
|
|
27
30
|
# @return [Gitlab::ObjectifiedHash]
|
|
28
|
-
def group(id)
|
|
29
|
-
get("/groups/#{url_encode id}")
|
|
31
|
+
def group(id, options = {})
|
|
32
|
+
get("/groups/#{url_encode id}", query: options)
|
|
30
33
|
end
|
|
31
34
|
|
|
32
35
|
# Creates a new group.
|
|
@@ -68,6 +71,55 @@ class Gitlab::Client
|
|
|
68
71
|
get("/groups/#{url_encode id}/members", query: options)
|
|
69
72
|
end
|
|
70
73
|
|
|
74
|
+
# Gets a list of all group members including inherited members.
|
|
75
|
+
#
|
|
76
|
+
# @example
|
|
77
|
+
# Gitlab.all_group_members(1)
|
|
78
|
+
# Gitlab.all_group_members(1, { per_page: 40 })
|
|
79
|
+
#
|
|
80
|
+
# @param [Integer] id The ID of a group.
|
|
81
|
+
# @param [Hash] options A customizable set of options.
|
|
82
|
+
# @option options [Integer] :page The page number.
|
|
83
|
+
# @option options [Integer] :per_page The number of results per page.
|
|
84
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
|
85
|
+
def all_group_members(id, options = {})
|
|
86
|
+
get("/groups/#{url_encode id}/members/all", query: options)
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
# Get a list of descendant groups of a group.
|
|
90
|
+
#
|
|
91
|
+
# @example
|
|
92
|
+
# Gitlab.group_descendants(42)
|
|
93
|
+
#
|
|
94
|
+
# @param [Integer] id the ID of a group
|
|
95
|
+
# @param [Hash] options A customizable set of options.
|
|
96
|
+
# @option options [String] :skip_groups Skip the group IDs passed.
|
|
97
|
+
# @option options [String] :all_available Show all the groups you have access to (defaults to false for authenticated users).
|
|
98
|
+
# @option options [String] :search Return the list of authorized groups matching the search criteria.
|
|
99
|
+
# @option options [String] :order_by Order groups by name or path. Default is name.
|
|
100
|
+
# @option options [String] :sort Order groups in asc or desc order. Default is asc.
|
|
101
|
+
# @option options [String] :statistics Include group statistics (admins only).
|
|
102
|
+
# @option options [String] :owned Limit to groups owned by the current user.
|
|
103
|
+
# @return [Array<Gitlab::ObjectifiedHash>] List of all subgroups under a group
|
|
104
|
+
def group_descendants(id, options = {})
|
|
105
|
+
get("/groups/#{url_encode id}/descendant_groups", query: options)
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
# Get a list of group members that are billable.
|
|
109
|
+
#
|
|
110
|
+
# @example
|
|
111
|
+
# Gitlab.group_billable_members(1)
|
|
112
|
+
# Gitlab.group_billable_members(1, { per_page: 40 })
|
|
113
|
+
#
|
|
114
|
+
# @param [Integer] id The ID of a group.
|
|
115
|
+
# @param [Hash] options A customizable set of options.
|
|
116
|
+
# @option options [Integer] :page The page number.
|
|
117
|
+
# @option options [Integer] :per_page The number of results per page.
|
|
118
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
|
119
|
+
def group_billable_members(id, options = {})
|
|
120
|
+
get("/groups/#{url_encode id}/billable_members", query: options)
|
|
121
|
+
end
|
|
122
|
+
|
|
71
123
|
# Get details of a single group member.
|
|
72
124
|
#
|
|
73
125
|
# @example
|
|
@@ -80,6 +132,18 @@ class Gitlab::Client
|
|
|
80
132
|
get("/groups/#{url_encode team_id}/members/#{user_id}")
|
|
81
133
|
end
|
|
82
134
|
|
|
135
|
+
# Gets a list of merge requests of a group.
|
|
136
|
+
#
|
|
137
|
+
# @example
|
|
138
|
+
# Gitlab.group_merge_requests(5)
|
|
139
|
+
#
|
|
140
|
+
# @param [Integer, String] group_id The ID or name of a group.
|
|
141
|
+
# @param [Hash] options A customizable set of options.
|
|
142
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
|
143
|
+
def group_merge_requests(group, options = {})
|
|
144
|
+
get("/groups/#{group}/merge_requests", query: options)
|
|
145
|
+
end
|
|
146
|
+
|
|
83
147
|
# Adds a user to group.
|
|
84
148
|
#
|
|
85
149
|
# @example
|
|
@@ -203,5 +267,186 @@ class Gitlab::Client
|
|
|
203
267
|
def group_issues(group, options = {})
|
|
204
268
|
get("/groups/#{group}/issues", query: options)
|
|
205
269
|
end
|
|
270
|
+
|
|
271
|
+
# Sync group with LDAP
|
|
272
|
+
#
|
|
273
|
+
# @example
|
|
274
|
+
# Gitlab.sync_ldap_group(1)
|
|
275
|
+
#
|
|
276
|
+
# @param [Integer] id The ID or name of a group.
|
|
277
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
|
278
|
+
def sync_ldap_group(id)
|
|
279
|
+
post("/groups/#{url_encode id}/ldap_sync")
|
|
280
|
+
end
|
|
281
|
+
|
|
282
|
+
# Add LDAP group link
|
|
283
|
+
#
|
|
284
|
+
# @example
|
|
285
|
+
# Gitlab.add_ldap_group_links(1, 'all', 50, 'ldap')
|
|
286
|
+
#
|
|
287
|
+
# @param [Integer] id The ID of a group
|
|
288
|
+
# @param [String] cn The CN of a LDAP group
|
|
289
|
+
# @param [Integer] group_access Minimum access level for members of the LDAP group.
|
|
290
|
+
# @param [String] provider LDAP provider for the LDAP group
|
|
291
|
+
# @return [Gitlab::ObjectifiedHash] Information about added ldap group link
|
|
292
|
+
def add_ldap_group_links(id, commonname, group_access, provider)
|
|
293
|
+
post("/groups/#{url_encode id}/ldap_group_links", body: { cn: commonname, group_access: group_access, provider: provider })
|
|
294
|
+
end
|
|
295
|
+
|
|
296
|
+
# Delete LDAP group link
|
|
297
|
+
#
|
|
298
|
+
# @example
|
|
299
|
+
# Gitlab.delete_ldap_group_links(1, 'all')
|
|
300
|
+
#
|
|
301
|
+
# @param [Integer] id The ID of a group
|
|
302
|
+
# @param [String] cn The CN of a LDAP group
|
|
303
|
+
# @return [Gitlab::ObjectifiedHash] Empty hash
|
|
304
|
+
def delete_ldap_group_links(id, commonname, provider)
|
|
305
|
+
delete("/groups/#{url_encode id}/ldap_group_links/#{url_encode provider}/#{url_encode commonname}")
|
|
306
|
+
end
|
|
307
|
+
|
|
308
|
+
# Gets group custom_attributes.
|
|
309
|
+
#
|
|
310
|
+
# @example
|
|
311
|
+
# Gitlab.group_custom_attributes(2)
|
|
312
|
+
#
|
|
313
|
+
# @param [Integer] group_id The ID of a group.
|
|
314
|
+
# @return [Gitlab::ObjectifiedHash]
|
|
315
|
+
def group_custom_attributes(group_id)
|
|
316
|
+
get("/groups/#{group_id}/custom_attributes")
|
|
317
|
+
end
|
|
318
|
+
|
|
319
|
+
# Gets single group custom_attribute.
|
|
320
|
+
#
|
|
321
|
+
# @example
|
|
322
|
+
# Gitlab.group_custom_attribute('key', 2)
|
|
323
|
+
#
|
|
324
|
+
# @param [String] key The custom_attributes key
|
|
325
|
+
# @param [Integer] group_id The ID of a group.
|
|
326
|
+
# @return [Gitlab::ObjectifiedHash]
|
|
327
|
+
def group_custom_attribute(key, group_id)
|
|
328
|
+
get("/groups/#{group_id}/custom_attributes/#{key}")
|
|
329
|
+
end
|
|
330
|
+
|
|
331
|
+
# Creates a new custom_attribute
|
|
332
|
+
#
|
|
333
|
+
# @example
|
|
334
|
+
# Gitlab.add_custom_attribute('some_new_key', 'some_new_value', 2)
|
|
335
|
+
#
|
|
336
|
+
# @param [String] key The custom_attributes key
|
|
337
|
+
# @param [String] value The custom_attributes value
|
|
338
|
+
# @param [Integer] group_id The ID of a group.
|
|
339
|
+
# @return [Gitlab::ObjectifiedHash]
|
|
340
|
+
def add_group_custom_attribute(key, value, group_id)
|
|
341
|
+
url = "/groups/#{group_id}/custom_attributes/#{key}"
|
|
342
|
+
put(url, body: { value: value })
|
|
343
|
+
end
|
|
344
|
+
|
|
345
|
+
# Delete custom_attribute
|
|
346
|
+
# Will delete a custom_attribute
|
|
347
|
+
#
|
|
348
|
+
# @example
|
|
349
|
+
# Gitlab.delete_group_custom_attribute('somekey', 2)
|
|
350
|
+
#
|
|
351
|
+
# @param [String] key The custom_attribute key to delete
|
|
352
|
+
# @param [Integer] group_id The ID of a group.
|
|
353
|
+
# @return [Boolean]
|
|
354
|
+
def delete_group_custom_attribute(key, group_id = nil)
|
|
355
|
+
delete("/groups/#{group_id}/custom_attributes/#{key}")
|
|
356
|
+
end
|
|
357
|
+
|
|
358
|
+
# List all the specified groups hooks
|
|
359
|
+
#
|
|
360
|
+
# @example
|
|
361
|
+
# Gitlab.list_group_hooks(3)
|
|
362
|
+
#
|
|
363
|
+
# @param [Integer] group_id The ID of a group.
|
|
364
|
+
# @return [Gitlab::PaginatedResponse] List of registered hooks https://docs.gitlab.com/ee/api/groups.html#hooks
|
|
365
|
+
def list_group_hooks(group_id)
|
|
366
|
+
get("/groups/#{group_id}/hooks")
|
|
367
|
+
end
|
|
368
|
+
|
|
369
|
+
# get specified group hook
|
|
370
|
+
#
|
|
371
|
+
# @example
|
|
372
|
+
# Gitlab.group_hook(3, 1)
|
|
373
|
+
#
|
|
374
|
+
# @param [Integer] group_id The ID of a group.
|
|
375
|
+
# @param [Integer] hook_id The ID of the hook.
|
|
376
|
+
# @return [Gitlab::ObjectifiedHash] The hook https://docs.gitlab.com/ee/api/groups.html#get-group-hook
|
|
377
|
+
def group_hook(group_id, hook_id)
|
|
378
|
+
get("/groups/#{group_id}/hooks/#{hook_id}")
|
|
379
|
+
end
|
|
380
|
+
|
|
381
|
+
# Add a new group hook
|
|
382
|
+
#
|
|
383
|
+
# @example
|
|
384
|
+
# Gitlab.add_group_hook(3, "https://example.com/my-hook-receiver", {token: "verify me"})
|
|
385
|
+
#
|
|
386
|
+
# @param [Integer] group_id The ID of a group.
|
|
387
|
+
# @param [String] the hook url which will receive the selected events
|
|
388
|
+
# @option options [Boolean] :name The name of the group.
|
|
389
|
+
# @option options [Boolean] :push_events Trigger hook on push events
|
|
390
|
+
# @potion options [String] :push_events_branch_filter Trigger hook on push events for matching branches only.
|
|
391
|
+
# @option options [Boolean] :issues_events Trigger hook on issues events
|
|
392
|
+
# @option options [Boolean] :confidential_issues_events Trigger hook on confidential issues events
|
|
393
|
+
# @option options [Boolean] :merge_requests_events Trigger hook on merge requests events
|
|
394
|
+
# @option options [Boolean] :tag_push_events Trigger hook on tag push events
|
|
395
|
+
# @option options [Boolean] :note_events Trigger hook on note events
|
|
396
|
+
# @option options [Boolean] :confidential_note_events Trigger hook on confidential note events
|
|
397
|
+
# @option options [Boolean] :job_events Trigger hook on job events
|
|
398
|
+
# @option options [Boolean] :pipeline_events Trigger hook on pipeline events
|
|
399
|
+
# @option options [Boolean] :wiki_page_events Trigger hook on wiki page events
|
|
400
|
+
# @option options [Boolean] :deployment_events Trigger hook on deployment events
|
|
401
|
+
# @option options [Boolean] :releases_events Trigger hook on release events
|
|
402
|
+
# @option options [Boolean] :subgroup_events Trigger hook on subgroup events
|
|
403
|
+
# @option options [Boolean] :enable_ssl_verification Do SSL verification when triggering the hook
|
|
404
|
+
# @option options [String] :token Secret token to validate received payloads; not returned in the response
|
|
405
|
+
# @return [Gitlab::ObjectifiedHash] Response body matches https://docs.gitlab.com/ee/api/groups.html#get-group-hook
|
|
406
|
+
def add_group_hook(group_id, url, options = {})
|
|
407
|
+
post("/groups/#{group_id}/hooks", body: options.merge(url: url))
|
|
408
|
+
end
|
|
409
|
+
|
|
410
|
+
# Edit a group hook
|
|
411
|
+
#
|
|
412
|
+
# @example
|
|
413
|
+
# Gitlab.edit_group_hook(3, 1, "https://example.com/my-hook-receiver", {token: "verify me"})
|
|
414
|
+
#
|
|
415
|
+
# @param [Integer] group_id The ID of a group.
|
|
416
|
+
# @param [Integer] hook_id The ID of a group.
|
|
417
|
+
# @param [String] the hook url which will receive the selected events
|
|
418
|
+
# @option options [Boolean] :name The name of the group.
|
|
419
|
+
# @option options [Boolean] :push_events Trigger hook on push events
|
|
420
|
+
# @potion options [String] :push_events_branch_filter Trigger hook on push events for matching branches only.
|
|
421
|
+
# @option options [Boolean] :issues_events Trigger hook on issues events
|
|
422
|
+
# @option options [Boolean] :confidential_issues_events Trigger hook on confidential issues events
|
|
423
|
+
# @option options [Boolean] :merge_requests_events Trigger hook on merge requests events
|
|
424
|
+
# @option options [Boolean] :tag_push_events Trigger hook on tag push events
|
|
425
|
+
# @option options [Boolean] :note_events Trigger hook on note events
|
|
426
|
+
# @option options [Boolean] :confidential_note_events Trigger hook on confidential note events
|
|
427
|
+
# @option options [Boolean] :job_events Trigger hook on job events
|
|
428
|
+
# @option options [Boolean] :pipeline_events Trigger hook on pipeline events
|
|
429
|
+
# @option options [Boolean] :wiki_page_events Trigger hook on wiki page events
|
|
430
|
+
# @option options [Boolean] :deployment_events Trigger hook on deployment events
|
|
431
|
+
# @option options [Boolean] :releases_events Trigger hook on release events
|
|
432
|
+
# @option options [Boolean] :subgroup_events Trigger hook on subgroup events
|
|
433
|
+
# @option options [Boolean] :enable_ssl_verification Do SSL verification when triggering the hook
|
|
434
|
+
# @option options [String] :token Secret token to validate received payloads; not returned in the response
|
|
435
|
+
# @return [Gitlab::ObjectifiedHash] Response body matches https://docs.gitlab.com/ee/api/groups.html#edit-group-hook
|
|
436
|
+
def edit_group_hook(group_id, hook_id, url, options = {})
|
|
437
|
+
post("/groups/#{group_id}/hooks/#{hook_id}", body: options.merge(url: url))
|
|
438
|
+
end
|
|
439
|
+
|
|
440
|
+
# Delete a group hook
|
|
441
|
+
#
|
|
442
|
+
# @example
|
|
443
|
+
# Gitlab.delete_group_hook(3, 1)
|
|
444
|
+
#
|
|
445
|
+
# @param [Integer] group_id The ID of a group.
|
|
446
|
+
# @param [Integer] hook_id The ID of a group.
|
|
447
|
+
# @return [Gitlab::ObjectifiedHash] no body, will evaluate to an empty hash. https://docs.gitlab.com/ee/api/groups.html#delete-group-hook
|
|
448
|
+
def delete_group_hook(group_id, hook_id)
|
|
449
|
+
delete("/groups/#{group_id}/hooks/#{hook_id}")
|
|
450
|
+
end
|
|
206
451
|
end
|
|
207
452
|
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class Gitlab::Client
|
|
4
|
+
# Defines methods related to issue links.
|
|
5
|
+
# @see https://docs.gitlab.com/ee/api/issue_links.html
|
|
6
|
+
module IssueLinks
|
|
7
|
+
# Gets a list of links for a issue.
|
|
8
|
+
#
|
|
9
|
+
# @example
|
|
10
|
+
# Gitlab.issue_links(5, 10)
|
|
11
|
+
#
|
|
12
|
+
# @param [Integer] project The ID of a project.
|
|
13
|
+
# @param [Integer] issue The ID of an issue.
|
|
14
|
+
# @option options [Integer] :page The page number.
|
|
15
|
+
# @option options [Integer] :per_page The number of results per page.
|
|
16
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
|
17
|
+
def issue_links(project, issue, options = {})
|
|
18
|
+
get("/projects/#{url_encode project}/issues/#{issue}/links", query: options)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# Creates a new issue link.
|
|
22
|
+
#
|
|
23
|
+
# @example
|
|
24
|
+
# Gitlab.create_issue_link(6, 1, 6, 2)
|
|
25
|
+
#
|
|
26
|
+
# @param [Integer, String] project The ID or name of a project.
|
|
27
|
+
# @param [Integer] issue The ID of an issue.
|
|
28
|
+
# @param [Integer] target_project_id Project ID the target issue is located in.
|
|
29
|
+
# @param [Integer] target_issue_iid The ID of the target issue.
|
|
30
|
+
# @return [Gitlab::ObjectifiedHash] Information about created link.
|
|
31
|
+
def create_issue_link(project, issue, target_project_id, target_issue_iid)
|
|
32
|
+
post("/projects/#{url_encode project}/issues/#{issue}/links", body: { target_project_id: target_project_id, target_issue_iid: target_issue_iid })
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# Deletes an issue link.
|
|
36
|
+
#
|
|
37
|
+
# @example
|
|
38
|
+
# Gitlab.delete_issue_link(5, 10, 123)
|
|
39
|
+
#
|
|
40
|
+
# @param [Integer] project The ID of a project.
|
|
41
|
+
# @param [Integer] issue The ID of an issue.
|
|
42
|
+
# @param [Integer] id The ID of a link.
|
|
43
|
+
# @return [Gitlab::ObjectifiedHash]
|
|
44
|
+
def delete_issue_link(project, issue, id)
|
|
45
|
+
delete("/projects/#{url_encode project}/issues/#{issue}/links/#{id}")
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
data/lib/gitlab/client/issues.rb
CHANGED
|
@@ -181,7 +181,7 @@ class Gitlab::Client
|
|
|
181
181
|
# @param [Integer] id The ID of an issue.
|
|
182
182
|
# @param [String] duration The time spent in human format. e.g: 3h30m
|
|
183
183
|
def add_time_spent_on_issue(project, id, duration)
|
|
184
|
-
post("/projects/#{url_encode project}/issues/#{id}/add_spent_time", body: { duration:
|
|
184
|
+
post("/projects/#{url_encode project}/issues/#{id}/add_spent_time", body: { duration: duration })
|
|
185
185
|
end
|
|
186
186
|
|
|
187
187
|
# Resets the total spent time for this issue to 0 seconds.
|
|
@@ -227,5 +227,16 @@ class Gitlab::Client
|
|
|
227
227
|
def merge_requests_closing_issue_on_merge(project, id)
|
|
228
228
|
get("/projects/#{url_encode project}/issues/#{id}/closed_by")
|
|
229
229
|
end
|
|
230
|
+
|
|
231
|
+
# List related merge requests
|
|
232
|
+
#
|
|
233
|
+
# @example
|
|
234
|
+
# Gitlab.related_merge_requests(3, 42)
|
|
235
|
+
#
|
|
236
|
+
# @param [Integer, String] project The ID or name of a project.
|
|
237
|
+
# @param [Integer] id The ID of an issue.
|
|
238
|
+
def related_merge_requests(project, id)
|
|
239
|
+
get("/projects/#{url_encode project}/issues/#{id}/related_merge_requests")
|
|
240
|
+
end
|
|
230
241
|
end
|
|
231
242
|
end
|
data/lib/gitlab/client/jobs.rb
CHANGED
|
@@ -36,6 +36,21 @@ class Gitlab::Client
|
|
|
36
36
|
get("/projects/#{url_encode project_id}/pipelines/#{pipeline_id}/jobs", query: options)
|
|
37
37
|
end
|
|
38
38
|
|
|
39
|
+
# Gets a list of Bridge Jobs from a pipeline
|
|
40
|
+
#
|
|
41
|
+
# @example
|
|
42
|
+
# Gitlab.pipeline_bridges(1, 2)
|
|
43
|
+
# Gitlab.pipeline_bridges("project", 2)
|
|
44
|
+
#
|
|
45
|
+
# @param [Integer, String] The ID or name of a project.
|
|
46
|
+
# @param [Integer] the id of the pipeline
|
|
47
|
+
# @param [Hash] options A customizable set of options.
|
|
48
|
+
# @option options [Array] :scope The scope of bridge jobs to show, one or array of: created, pending, running, failed, success, canceled, skipped, manual; showing all bridge jobs if none provided.
|
|
49
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
|
50
|
+
def pipeline_bridges(project_id, pipeline_id, options = {})
|
|
51
|
+
get("/projects/#{url_encode project_id}/pipelines/#{pipeline_id}/bridges", query: options)
|
|
52
|
+
end
|
|
53
|
+
|
|
39
54
|
# Gets a single job
|
|
40
55
|
#
|
|
41
56
|
# @example
|
|
@@ -70,17 +85,71 @@ class Gitlab::Client
|
|
|
70
85
|
# Gitlab.job_artifacts_download(1, "master", "release")
|
|
71
86
|
# Gitlab.job_artifacts_download("project", "master", "release")
|
|
72
87
|
#
|
|
73
|
-
# @param [Integer, String]
|
|
74
|
-
# @param [String] ref
|
|
75
|
-
# @param [String] job
|
|
76
|
-
# @return [
|
|
88
|
+
# @param [Integer, String] project_id The ID or name of a project.
|
|
89
|
+
# @param [String] ref Ref Name
|
|
90
|
+
# @param [String] job jobname
|
|
91
|
+
# @return [Gitlab::FileResponse]
|
|
77
92
|
def job_artifacts_download(project_id, ref_name, job_name)
|
|
78
|
-
get("/projects/#{url_encode project_id}/jobs/artifacts/#{ref_name}/download",
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
93
|
+
get("/projects/#{url_encode project_id}/jobs/artifacts/#{ref_name}/download",
|
|
94
|
+
query: { job: job_name },
|
|
95
|
+
format: nil,
|
|
96
|
+
headers: { Accept: 'application/octet-stream' },
|
|
97
|
+
parser: proc { |body, _|
|
|
98
|
+
if body.encoding == Encoding::ASCII_8BIT # binary response
|
|
99
|
+
::Gitlab::FileResponse.new StringIO.new(body, 'rb+')
|
|
100
|
+
else # error with json response
|
|
101
|
+
::Gitlab::Request.parse(body)
|
|
102
|
+
end
|
|
103
|
+
})
|
|
82
104
|
end
|
|
83
105
|
|
|
106
|
+
# Download a single artifact file by job ID
|
|
107
|
+
#
|
|
108
|
+
# @example
|
|
109
|
+
# Gitlab.download_job_artifact_file(1, 5, "some/release/file.pdf")
|
|
110
|
+
#
|
|
111
|
+
# @param [Integer, String] project_id(required) The ID or name of a project.
|
|
112
|
+
# @param [String] job_id(required) The unique job identifier.
|
|
113
|
+
# @param [String] artifact_path(required) Path to a file inside the artifacts archive.
|
|
114
|
+
# @return [Gitlab::FileResponse]
|
|
115
|
+
def download_job_artifact_file(project_id, job_id, artifact_path)
|
|
116
|
+
get("/projects/#{url_encode project_id}/jobs/#{job_id}/artifacts/#{artifact_path}",
|
|
117
|
+
format: nil,
|
|
118
|
+
headers: { Accept: 'application/octet-stream' },
|
|
119
|
+
parser: proc { |body, _|
|
|
120
|
+
if body.encoding == Encoding::ASCII_8BIT # binary response
|
|
121
|
+
::Gitlab::FileResponse.new StringIO.new(body, 'rb+')
|
|
122
|
+
else # error with json response
|
|
123
|
+
::Gitlab::Request.parse(body)
|
|
124
|
+
end
|
|
125
|
+
})
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
# Download a single artifact file from specific tag or branch
|
|
129
|
+
#
|
|
130
|
+
# @example
|
|
131
|
+
# Gitlab.download_branch_artifact_file(1, "master", "some/release/file.pdf", 'pdf')
|
|
132
|
+
#
|
|
133
|
+
# @param [Integer, String] project_id(required) The ID or name of a project.
|
|
134
|
+
# @param [String] ref_name(required) Branch or tag name in repository. HEAD or SHA references are not supported.
|
|
135
|
+
# @param [String] artifact_path(required) Path to a file inside the artifacts archive.
|
|
136
|
+
# @param [String] job(required) The name of the job.
|
|
137
|
+
# @return [Gitlab::FileResponse]
|
|
138
|
+
def download_branch_artifact_file(project_id, ref_name, artifact_path, job)
|
|
139
|
+
get("/projects/#{url_encode project_id}/jobs/artifacts/#{ref_name}/raw/#{artifact_path}",
|
|
140
|
+
query: { job: job },
|
|
141
|
+
format: nil,
|
|
142
|
+
headers: { Accept: 'application/octet-stream' },
|
|
143
|
+
parser: proc { |body, _|
|
|
144
|
+
if body.encoding == Encoding::ASCII_8BIT # binary response
|
|
145
|
+
::Gitlab::FileResponse.new StringIO.new(body, 'rb+')
|
|
146
|
+
else # error with json response
|
|
147
|
+
::Gitlab::Request.parse(body)
|
|
148
|
+
end
|
|
149
|
+
})
|
|
150
|
+
end
|
|
151
|
+
alias download_tag_artifact_file download_branch_artifact_file
|
|
152
|
+
|
|
84
153
|
# Get Job Trace
|
|
85
154
|
#
|
|
86
155
|
# @example
|
|
@@ -163,5 +232,19 @@ class Gitlab::Client
|
|
|
163
232
|
def job_artifacts_keep(project_id, job_id)
|
|
164
233
|
post("/projects/#{url_encode project_id}/jobs/#{job_id}/artifacts/keep")
|
|
165
234
|
end
|
|
235
|
+
|
|
236
|
+
# Delete Artifacts
|
|
237
|
+
# Deletes the artifacts associated with a job.
|
|
238
|
+
#
|
|
239
|
+
# @example
|
|
240
|
+
# Gitlab.job_artifacts_delete(1,1)
|
|
241
|
+
# Gitlab.job_artifacts_delete("project", 1)
|
|
242
|
+
#
|
|
243
|
+
# @param [Integer, String] The ID or name of a project.
|
|
244
|
+
# @param [Integer] the id of the job
|
|
245
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
|
246
|
+
def job_artifacts_delete(project_id, job_id)
|
|
247
|
+
delete("/projects/#{url_encode project_id}/jobs/#{job_id}/artifacts")
|
|
248
|
+
end
|
|
166
249
|
end
|
|
167
250
|
end
|
data/lib/gitlab/client/keys.rb
CHANGED
|
@@ -14,5 +14,16 @@ class Gitlab::Client
|
|
|
14
14
|
def key(id)
|
|
15
15
|
get("/keys/#{id}")
|
|
16
16
|
end
|
|
17
|
+
|
|
18
|
+
# Gets information about a key by key fingerprint.
|
|
19
|
+
#
|
|
20
|
+
# @example
|
|
21
|
+
# Gitlab.key_by_fingerprint("9f:70:33:b3:50:4d:9a:a3:ef:ea:13:9b:87:0f:7f:7e")
|
|
22
|
+
#
|
|
23
|
+
# @param [String] fingerprint The Fingerprint of a key.
|
|
24
|
+
# @return [Gitlab::ObjectifiedHash]
|
|
25
|
+
def key_by_fingerprint(fingerprint)
|
|
26
|
+
get('/keys', query: { fingerprint: fingerprint })
|
|
27
|
+
end
|
|
17
28
|
end
|
|
18
29
|
end
|
data/lib/gitlab/client/labels.rb
CHANGED
|
@@ -58,7 +58,7 @@ class Gitlab::Client
|
|
|
58
58
|
# @param [String] name The name of a label.
|
|
59
59
|
# @return [Gitlab::ObjectifiedHash] Information about deleted label.
|
|
60
60
|
def delete_label(project, name)
|
|
61
|
-
delete("/projects/#{url_encode project}/labels
|
|
61
|
+
delete("/projects/#{url_encode project}/labels/#{name}")
|
|
62
62
|
end
|
|
63
63
|
|
|
64
64
|
# Subscribes the user to a label to receive notifications
|