gitlab 4.14.0 → 4.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -3
- data/lib/gitlab.rb +2 -1
- data/lib/gitlab/api.rb +2 -0
- data/lib/gitlab/cli.rb +4 -4
- data/lib/gitlab/cli_helpers.rb +9 -15
- data/lib/gitlab/client.rb +5 -1
- data/lib/gitlab/client/commits.rb +24 -3
- data/lib/gitlab/client/container_registry.rb +1 -1
- data/lib/gitlab/client/epic_issues.rb +23 -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 +15 -0
- data/lib/gitlab/client/jobs.rb +77 -8
- data/lib/gitlab/client/labels.rb +1 -1
- data/lib/gitlab/client/merge_request_approvals.rb +68 -0
- data/lib/gitlab/client/merge_requests.rb +18 -3
- data/lib/gitlab/client/notes.rb +27 -0
- data/lib/gitlab/client/pipeline_schedules.rb +4 -4
- data/lib/gitlab/client/pipelines.rb +12 -0
- data/lib/gitlab/client/projects.rb +35 -0
- data/lib/gitlab/client/resource_state_events.rb +57 -0
- data/lib/gitlab/client/runners.rb +59 -21
- data/lib/gitlab/client/user_snippets.rb +114 -0
- data/lib/gitlab/client/users.rb +21 -2
- data/lib/gitlab/error.rb +19 -0
- data/lib/gitlab/help.rb +6 -5
- data/lib/gitlab/objectified_hash.rb +23 -7
- data/lib/gitlab/page_links.rb +1 -1
- data/lib/gitlab/paginated_response.rb +23 -39
- data/lib/gitlab/request.rb +0 -2
- data/lib/gitlab/shell_history.rb +2 -2
- data/lib/gitlab/version.rb +1 -1
- metadata +10 -40
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
|
@@ -31,6 +31,62 @@ class Gitlab::Client
|
|
31
31
|
post("/projects/#{url_encode project}/approvals", body: options)
|
32
32
|
end
|
33
33
|
|
34
|
+
# Gets MR Approval Rules for a project
|
35
|
+
#
|
36
|
+
# @example
|
37
|
+
# Gitlab.project_merge_request_approval_rules(1)
|
38
|
+
#
|
39
|
+
# @param [Integer] project The ID of a project.
|
40
|
+
# @return [Gitlab::ObjectifiedHash] MR approval rules for the project
|
41
|
+
def project_merge_request_approval_rules(project)
|
42
|
+
get("/projects/#{url_encode project}/approval_rules")
|
43
|
+
end
|
44
|
+
|
45
|
+
# Create MR Approval Rule for a project
|
46
|
+
#
|
47
|
+
# @example
|
48
|
+
# Gitlab.create_project_merge_request_approval_rule(1, {name: "security", approvals_required: 1})
|
49
|
+
#
|
50
|
+
# @param [Integer] project(required) The ID of a project.
|
51
|
+
# @option options [String] :name(required) The name of the approval rule
|
52
|
+
# @option options [Integer] :approvals_required(required) The number of required approvals for this rule
|
53
|
+
# @option options [Array] :user_ids(optional) The ids of users as approvers
|
54
|
+
# @option options [Array] :group_ids(optional) The ids of groups as approvers
|
55
|
+
# @option options [Array] :protected_branch_ids(optional) The ids of protected branches to scope the rule by
|
56
|
+
# @return [Gitlab::ObjectifiedHash] New MR approval rule
|
57
|
+
def create_project_merge_request_approval_rule(project, options = {})
|
58
|
+
post("/projects/#{url_encode project}/approval_rules", body: options)
|
59
|
+
end
|
60
|
+
|
61
|
+
# Update MR Approval Rule for a project
|
62
|
+
#
|
63
|
+
# @example
|
64
|
+
# Gitlab.update_project_merge_request_approval_rule(1, {name: "security", approvals_required: 2})
|
65
|
+
#
|
66
|
+
# @param [Integer] project(required) The ID of a project.
|
67
|
+
# @param [Integer] approval_rule_id(required) The ID of a project Approval Rule
|
68
|
+
# @option options [String] :name(required) The name of the approval rule
|
69
|
+
# @option options [Integer] :approvals_required(required) The number of required approvals for this rule
|
70
|
+
# @option options [Array] :user_ids(optional) The ids of users as approvers
|
71
|
+
# @option options [Array] :group_ids(optional) The ids of groups as approvers
|
72
|
+
# @option options [Array] :protected_branch_ids(optional) The ids of protected branches to scope the rule by
|
73
|
+
# @return [Gitlab::ObjectifiedHash] Updated MR approval rule
|
74
|
+
def update_project_merge_request_approval_rule(project, approval_rule_id, options = {})
|
75
|
+
put("/projects/#{url_encode project}/approval_rules/#{approval_rule_id}", body: options)
|
76
|
+
end
|
77
|
+
|
78
|
+
# Delete MR Approval Rule for a project
|
79
|
+
#
|
80
|
+
# @example
|
81
|
+
# Gitlab.delete_project_merge_request_approval_rule(1, 1)
|
82
|
+
#
|
83
|
+
# @param [Integer] project(required) The ID of a project.
|
84
|
+
# @param [Integer] approval_rule_id(required) The ID of a approval rule
|
85
|
+
# @return [void] This API call returns an empty response body
|
86
|
+
def delete_project_merge_request_approval_rule(project, approval_rule_id)
|
87
|
+
delete("/projects/#{url_encode project}/approval_rules/#{approval_rule_id}")
|
88
|
+
end
|
89
|
+
|
34
90
|
# Change allowed approvers and approver groups for a project
|
35
91
|
#
|
36
92
|
# @example
|
@@ -109,5 +165,17 @@ class Gitlab::Client
|
|
109
165
|
def unapprove_merge_request(project, merge_request, options = {})
|
110
166
|
post("/projects/#{url_encode project}/merge_requests/#{merge_request}/unapprove", body: options)
|
111
167
|
end
|
168
|
+
|
169
|
+
# Get the approval state of merge requests
|
170
|
+
#
|
171
|
+
# @example
|
172
|
+
# Gitlab.merge_request_approval_state(5, 36)
|
173
|
+
#
|
174
|
+
# @param [Integer, String] project The ID or name of a project.
|
175
|
+
# @param [Integer] id The ID of a merge request.
|
176
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
177
|
+
def merge_request_approval_state(project, id)
|
178
|
+
get("/projects/#{url_encode project}/merge_requests/#{id}/approval_state")
|
179
|
+
end
|
112
180
|
end
|
113
181
|
end
|
@@ -35,12 +35,16 @@ class Gitlab::Client
|
|
35
35
|
#
|
36
36
|
# @example
|
37
37
|
# Gitlab.merge_request(5, 36)
|
38
|
+
# Gitlab.merge_request(5, 36, { include_diverged_commits_count: true })
|
38
39
|
#
|
39
40
|
# @param [Integer, String] project The ID or name of a project.
|
40
41
|
# @param [Integer] id The ID of a merge request.
|
42
|
+
# @option options [Boolean] :render_html If true response includes rendered HTML for title and description.
|
43
|
+
# @option options [Boolean] :include_diverged_commits_count If true response includes the commits behind the target branch.
|
44
|
+
# @option options [Boolean] :include_rebase_in_progress If true response includes whether a rebase operation is in progress.
|
41
45
|
# @return <Gitlab::ObjectifiedHash]
|
42
|
-
def merge_request(project, id)
|
43
|
-
get("/projects/#{url_encode project}/merge_requests/#{id}")
|
46
|
+
def merge_request(project, id, options = {})
|
47
|
+
get("/projects/#{url_encode project}/merge_requests/#{id}", query: options)
|
44
48
|
end
|
45
49
|
|
46
50
|
# Gets a list of merge request pipelines.
|
@@ -81,8 +85,14 @@ class Gitlab::Client
|
|
81
85
|
# @option options [String] :source_branch (required) The source branch name.
|
82
86
|
# @option options [String] :target_branch (required) The target branch name.
|
83
87
|
# @option options [Integer] :assignee_id (optional) The ID of a user to assign merge request.
|
88
|
+
# @option options [Array<Integer>] :assignee_ids (optional) The ID of the user(s) to assign the MR to. Set to 0 or provide an empty value to unassign all assignees.
|
89
|
+
# @option options [String] :description (optional) Description of MR. Limited to 1,048,576 characters.
|
84
90
|
# @option options [Integer] :target_project_id (optional) The target project ID.
|
85
91
|
# @option options [String] :labels (optional) Labels as a comma-separated list.
|
92
|
+
# @option options [Integer] :milestone_id (optional) The global ID of a milestone
|
93
|
+
# @option options [Boolean] :remove_source_branch (optional) Flag indicating if a merge request should remove the source branch when merging
|
94
|
+
# @option options [Boolean] :allow_collaboration (optional) Allow commits from members who can merge to the target branch
|
95
|
+
# @option options [Boolean] :squash (optional) Squash commits into a single commit when merging
|
86
96
|
# @return [Gitlab::ObjectifiedHash] Information about created merge request.
|
87
97
|
def create_merge_request(project, title, options = {})
|
88
98
|
body = { title: title }.merge(options)
|
@@ -115,7 +125,12 @@ class Gitlab::Client
|
|
115
125
|
# @param [Integer, String] project The ID or name of a project.
|
116
126
|
# @param [Integer] id The ID of a merge request.
|
117
127
|
# @param [Hash] options A customizable set of options.
|
118
|
-
# @option options [String] :merge_commit_message Custom merge commit message
|
128
|
+
# @option options [String] :merge_commit_message(optional) Custom merge commit message
|
129
|
+
# @option options [String] :squash_commit_message(optional) Custom squash commit message
|
130
|
+
# @option options [Boolean] :squash(optional) if true the commits will be squashed into a single commit on merge
|
131
|
+
# @option options [Boolean] :should_remove_source_branch(optional) if true removes the source branch
|
132
|
+
# @option options [Boolean] :merge_when_pipeline_succeeds(optional) if true the MR is merged when the pipeline succeeds
|
133
|
+
# @option options [String] :sha(optional) if present, then this SHA must match the HEAD of the source branch, otherwise the merge will fail
|
119
134
|
# @return [Gitlab::ObjectifiedHash] Information about updated merge request.
|
120
135
|
def accept_merge_request(project, id, options = {})
|
121
136
|
put("/projects/#{url_encode project}/merge_requests/#{id}/merge", body: options)
|
data/lib/gitlab/client/notes.rb
CHANGED
@@ -60,6 +60,20 @@ class Gitlab::Client
|
|
60
60
|
end
|
61
61
|
alias merge_request_comments merge_request_notes
|
62
62
|
|
63
|
+
# Gets a list of notes for an epic.
|
64
|
+
#
|
65
|
+
# @example
|
66
|
+
# Gitlab.epic_notes(5, 10)
|
67
|
+
#
|
68
|
+
# @param [Integer] project The ID of a group.
|
69
|
+
# @param [Integer] epic The ID of an epic.
|
70
|
+
# @option options [Integer] :page The page number.
|
71
|
+
# @option options [Integer] :per_page The number of results per page.
|
72
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
73
|
+
def epic_notes(group, epic, options = {})
|
74
|
+
get("/groups/#{url_encode group}/epics/#{epic}/notes", query: options)
|
75
|
+
end
|
76
|
+
|
63
77
|
# Gets a single wall note.
|
64
78
|
#
|
65
79
|
# @example
|
@@ -162,6 +176,19 @@ class Gitlab::Client
|
|
162
176
|
end
|
163
177
|
alias create_merge_request_comment create_merge_request_note
|
164
178
|
|
179
|
+
# Creates a new epic note.
|
180
|
+
#
|
181
|
+
# @example
|
182
|
+
# Gitlab.create_epic_note(6, 1, 'Adding a note to my epic.')
|
183
|
+
#
|
184
|
+
# @param [Integer, String] group The ID or name of a group.
|
185
|
+
# @param [Integer] epic The ID of an epic.
|
186
|
+
# @param [String] body The body of a note.
|
187
|
+
# @return [Gitlab::ObjectifiedHash] Information about created note.
|
188
|
+
def create_epic_note(group, epic, body)
|
189
|
+
post("/groups/#{url_encode group}/epics/#{epic}/notes", body: { body: body })
|
190
|
+
end
|
191
|
+
|
165
192
|
# Deletes a wall note.
|
166
193
|
#
|
167
194
|
# @example
|
@@ -44,7 +44,7 @@ class Gitlab::Client
|
|
44
44
|
# @option options [Boolean] :active The activation of pipeline schedule. If false is set, the pipeline schedule will deactivated initially (default: true).
|
45
45
|
# @return [Array<Gitlab::ObjectifiedHash>]
|
46
46
|
def create_pipeline_schedule(project, options = {})
|
47
|
-
post("/projects/#{url_encode project}/pipeline_schedules",
|
47
|
+
post("/projects/#{url_encode project}/pipeline_schedules", body: options)
|
48
48
|
end
|
49
49
|
|
50
50
|
# Updates the pipeline schedule of a project.
|
@@ -62,7 +62,7 @@ class Gitlab::Client
|
|
62
62
|
# @option options [Boolean] :active The activation of pipeline schedule. If false is set, the pipeline schedule will deactivated initially (default: true).
|
63
63
|
# @return [Array<Gitlab::ObjectifiedHash>] The updated pipeline schedule.
|
64
64
|
def edit_pipeline_schedule(project, pipeline_schedule_id, options = {})
|
65
|
-
put("/projects/#{url_encode project}/pipeline_schedules/#{pipeline_schedule_id}",
|
65
|
+
put("/projects/#{url_encode project}/pipeline_schedules/#{pipeline_schedule_id}", body: options)
|
66
66
|
end
|
67
67
|
|
68
68
|
# Take ownership of a pipeline schedule.
|
@@ -101,7 +101,7 @@ class Gitlab::Client
|
|
101
101
|
# @option options [String] :value The value of a variable
|
102
102
|
# @return [Array<Gitlab::ObjectifiedHash>] The created pipeline schedule variable.
|
103
103
|
def create_pipeline_schedule_variable(project, pipeline_schedule_id, options = {})
|
104
|
-
post("/projects/#{url_encode project}/pipeline_schedules/#{pipeline_schedule_id}/variables",
|
104
|
+
post("/projects/#{url_encode project}/pipeline_schedules/#{pipeline_schedule_id}/variables", body: options)
|
105
105
|
end
|
106
106
|
|
107
107
|
# Updates the variable of a pipeline schedule.
|
@@ -116,7 +116,7 @@ class Gitlab::Client
|
|
116
116
|
# @option options [String] :value The value of a variable.
|
117
117
|
# @return [Array<Gitlab::ObjectifiedHash>] The updated pipeline schedule variable.
|
118
118
|
def edit_pipeline_schedule_variable(project, pipeline_schedule_id, key, options = {})
|
119
|
-
put("/projects/#{url_encode project}/pipeline_schedules/#{pipeline_schedule_id}/variables/#{url_encode key}",
|
119
|
+
put("/projects/#{url_encode project}/pipeline_schedules/#{pipeline_schedule_id}/variables/#{url_encode key}", body: options)
|
120
120
|
end
|
121
121
|
|
122
122
|
# Delete the variable of a pipeline schedule
|
@@ -31,6 +31,18 @@ class Gitlab::Client
|
|
31
31
|
get("/projects/#{url_encode project}/pipelines/#{id}")
|
32
32
|
end
|
33
33
|
|
34
|
+
# Gets a single pipeline's test report.
|
35
|
+
#
|
36
|
+
# @example
|
37
|
+
# Gitlab.pipeline_test_report(5, 36)
|
38
|
+
#
|
39
|
+
# @param [Integer, String] project The ID or name of a project.
|
40
|
+
# @param [Integer] id The ID of a pipeline.
|
41
|
+
# @return [Gitlab::ObjectifiedHash]
|
42
|
+
def pipeline_test_report(project, id)
|
43
|
+
get("/projects/#{url_encode project}/pipelines/#{id}/test_report")
|
44
|
+
end
|
45
|
+
|
34
46
|
# Create a pipeline.
|
35
47
|
#
|
36
48
|
# @example
|
@@ -102,6 +102,22 @@ class Gitlab::Client
|
|
102
102
|
get("/projects/#{url_encode project}/members", query: options)
|
103
103
|
end
|
104
104
|
|
105
|
+
# Gets a list of all project team members including inherited members.
|
106
|
+
#
|
107
|
+
# @example
|
108
|
+
# Gitlab.all_members(42)
|
109
|
+
# Gitlab.all_members('gitlab')
|
110
|
+
#
|
111
|
+
# @param [Integer, String] project The ID or path of a project.
|
112
|
+
# @param [Hash] options A customizable set of options.
|
113
|
+
# @option options [String] :query The search query.
|
114
|
+
# @option options [Integer] :page The page number.
|
115
|
+
# @option options [Integer] :per_page The number of results per page.
|
116
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
117
|
+
def all_members(project, options = {})
|
118
|
+
get("/projects/#{url_encode project}/members/all", query: options)
|
119
|
+
end
|
120
|
+
|
105
121
|
# Gets a project team member.
|
106
122
|
#
|
107
123
|
# @example
|
@@ -519,6 +535,25 @@ class Gitlab::Client
|
|
519
535
|
delete("/projects/#{url_encode id}/star")
|
520
536
|
end
|
521
537
|
|
538
|
+
# Get a list of visible projects that the given user has starred.
|
539
|
+
# @see https://docs.gitlab.com/ee/api/projects.html#list-projects-starred-by-a-user
|
540
|
+
#
|
541
|
+
# @example
|
542
|
+
# Gitlab.user_starred_projects(1)
|
543
|
+
# Gitlab.user_starred_projects(1, { order_by: 'last_activity_at' })
|
544
|
+
# Gitlab.user_starred_projects('username', { order_by: 'name', sort: 'asc' })
|
545
|
+
#
|
546
|
+
# @param [Integer, String] user_id The ID or username of the user.
|
547
|
+
# @param [Hash] options A customizable set of options.
|
548
|
+
# @option options [String] :per_page Number of projects to return per page
|
549
|
+
# @option options [String] :page The page to retrieve
|
550
|
+
# @option options [String] :order_by Return projects ordered by id, name, path, created_at, updated_at, or last_activity_at fields.
|
551
|
+
# @option options [String] :sort Return projects sorted in asc or desc order.
|
552
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
553
|
+
def user_starred_projects(user_id, options = {})
|
554
|
+
get("/users/#{url_encode user_id}/starred_projects", query: options)
|
555
|
+
end
|
556
|
+
|
522
557
|
# Get a list of visible projects for the given user.
|
523
558
|
# @see https://docs.gitlab.com/ee/api/projects.html#list-user-projects
|
524
559
|
#
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Gitlab::Client
|
4
|
+
# Defines methods related to resource state events.
|
5
|
+
# @see https://docs.gitlab.com/ee/api/resource_state_events.html
|
6
|
+
module ResourceStateEvents
|
7
|
+
# Gets a list of all state events for a single issue.
|
8
|
+
#
|
9
|
+
# @example
|
10
|
+
# Gitlab.issue_state_events(5, 42)
|
11
|
+
#
|
12
|
+
# @param [Integer, String] project The ID or name of a project.
|
13
|
+
# @param [Integer] issue_iid The IID of an issue.
|
14
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
15
|
+
def issue_state_events(project, issue_iid)
|
16
|
+
get("/projects/#{url_encode project}/issues/#{issue_iid}/resource_state_events")
|
17
|
+
end
|
18
|
+
|
19
|
+
# Returns a single state event for a specific project issue
|
20
|
+
#
|
21
|
+
# @example
|
22
|
+
# Gitlab.issue_state_event(5, 42, 1)
|
23
|
+
#
|
24
|
+
# @param [Integer, String] project The ID or name of a project.
|
25
|
+
# @param [Integer] issue_iid The IID of an issue.
|
26
|
+
# @param [Integer] id The ID of a resource event.
|
27
|
+
# @return Gitlab::ObjectifiedHash
|
28
|
+
def issue_state_event(project, issue_iid, id)
|
29
|
+
get("/projects/#{url_encode project}/issues/#{issue_iid}/resource_state_events/#{id}")
|
30
|
+
end
|
31
|
+
|
32
|
+
# Gets a list of all state events for a single merge request.
|
33
|
+
#
|
34
|
+
# @example
|
35
|
+
# Gitlab.merge_request_state_events(5, 42)
|
36
|
+
#
|
37
|
+
# @param [Integer, String] project The ID or name of a project.
|
38
|
+
# @param [Integer] merge_request_iid The IID of a merge request.
|
39
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
40
|
+
def merge_request_state_events(project, merge_request_iid)
|
41
|
+
get("/projects/#{url_encode project}/merge_requests/#{merge_request_iid}/resource_state_events")
|
42
|
+
end
|
43
|
+
|
44
|
+
# Returns a single state event for a specific project merge request
|
45
|
+
#
|
46
|
+
# @example
|
47
|
+
# Gitlab.merge_request_state_event(5, 42, 1)
|
48
|
+
#
|
49
|
+
# @param [Integer, String] project The ID or name of a project.
|
50
|
+
# @param [Integer] merge_request_iid The IID of an merge request.
|
51
|
+
# @param [Integer] id The ID of a state event.
|
52
|
+
# @return Gitlab::ObjectifiedHash
|
53
|
+
def merge_request_state_event(project, merge_request_iid, id)
|
54
|
+
get("/projects/#{url_encode project}/merge_requests/#{merge_request_iid}/resource_state_events/#{id}")
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -9,11 +9,13 @@ class Gitlab::Client
|
|
9
9
|
#
|
10
10
|
# @example
|
11
11
|
# Gitlab.runners
|
12
|
-
# Gitlab.runners(:active)
|
13
|
-
# Gitlab.runners(:
|
12
|
+
# Gitlab.runners(type: 'instance_type', status: 'active')
|
13
|
+
# Gitlab.runners(tag_list: 'tag1,tag2')
|
14
14
|
#
|
15
15
|
# @param [Hash] options A customizable set of options.
|
16
|
-
# @option options [String] :
|
16
|
+
# @option options [String] :type(optional) The type of runners to show, one of: instance_type, group_type, project_type
|
17
|
+
# @option options [String] :status(optional) The status of runners to show, one of: active, paused, online, offline
|
18
|
+
# @option options [String] :tag_list(optional) List of the runners tags (separated by comma)
|
17
19
|
# @return [Array<Gitlab::ObjectifiedHash>]
|
18
20
|
def runners(options = {})
|
19
21
|
get('/runners', query: options)
|
@@ -24,9 +26,13 @@ class Gitlab::Client
|
|
24
26
|
#
|
25
27
|
# @example
|
26
28
|
# Gitlab.all_runners
|
29
|
+
# Gitlab.all_runners(type: 'instance_type', status: 'active')
|
30
|
+
# Gitlab.all_runners(tag_list: 'tag1,tag2')
|
27
31
|
#
|
28
32
|
# @param [Hash] options A customizable set of options.
|
29
|
-
# @option options [String] :
|
33
|
+
# @option options [String] :type(optional) The type of runners to show, one of: instance_type, group_type, project_type
|
34
|
+
# @option options [String] :status(optional) The status of runners to show, one of: active, paused, online, offline
|
35
|
+
# @option options [String] :tag_list(optional) List of the runners tags (separated by comma)
|
30
36
|
# @return [Array<Gitlab::ObjectifiedHash>]
|
31
37
|
def all_runners(options = {})
|
32
38
|
get('/runners/all', query: options)
|
@@ -50,15 +56,19 @@ class Gitlab::Client
|
|
50
56
|
# @example
|
51
57
|
# Gitlab.update_runner(42, { description: 'Awesome runner' })
|
52
58
|
# Gitlab.update_runner(42, { active: false })
|
53
|
-
# Gitlab.update_runner(42, { tag_list: [ 'awesome', 'runner' ] })
|
54
59
|
#
|
55
60
|
# @param [Integer, String] id The ID of a runner
|
56
61
|
# @param [Hash] options A customizable set of options.
|
57
|
-
# @option options [String] :
|
58
|
-
# @option options [
|
62
|
+
# @option options [String] :description(optional) The description of a runner
|
63
|
+
# @option options [Boolean] :active(optional) The state of a runner; can be set to true or false
|
64
|
+
# @option options [String] :tag_list(optional) The list of tags for a runner; put array of tags, that should be finally assigned to a runner(separated by comma)
|
65
|
+
# @option options [Boolean] :run_untagged(optional) Flag indicating the runner can execute untagged jobs
|
66
|
+
# @option options [Boolean] :locked(optional) Flag indicating the runner is locked
|
67
|
+
# @option options [String] :access_level(optional) The access_level of the runner; not_protected or ref_protected
|
68
|
+
# @option options [Integer] :maximum_timeout(optional) Maximum timeout set when this runner will handle the job
|
59
69
|
# @return <Gitlab::ObjectifiedHash>
|
60
70
|
def update_runner(id, options = {})
|
61
|
-
put("/runners/#{id}",
|
71
|
+
put("/runners/#{id}", body: options)
|
62
72
|
end
|
63
73
|
|
64
74
|
# Remove a runner.
|
@@ -68,19 +78,23 @@ class Gitlab::Client
|
|
68
78
|
# Gitlab.delete_runner(42)
|
69
79
|
#
|
70
80
|
# @param [Integer, String] id The ID of a runner
|
71
|
-
# @return
|
81
|
+
# @return [nil] This API call returns an empty response body.
|
72
82
|
def delete_runner(id)
|
73
83
|
delete("/runners/#{id}")
|
74
84
|
end
|
75
85
|
|
76
|
-
#
|
86
|
+
# List jobs that are being processed or were processed by specified runner.
|
77
87
|
#
|
78
88
|
# @example
|
79
89
|
# Gitlab.runner_jobs(1)
|
90
|
+
# Gitlab.runner_jobs(1, status: 'success')
|
91
|
+
# Gitlab.runner_jobs(1, sort: 'desc')
|
80
92
|
#
|
81
93
|
# @param [Integer] id The ID of a runner.
|
82
94
|
# @param [Hash] options A customizable set of options.
|
83
|
-
# @option options [String] :status Status of the job; one of: running, success, failed, canceled
|
95
|
+
# @option options [String] :status(optional) Status of the job; one of: running, success, failed, canceled
|
96
|
+
# @option options [String] :order_by(optional) Order jobs by id.
|
97
|
+
# @option options [String] :sort(optional) Sort jobs in asc or desc order (default: desc)
|
84
98
|
# @return [Array<Gitlab::ObjectifiedHash>]
|
85
99
|
def runner_jobs(runner_id, options = {})
|
86
100
|
get("/runners/#{url_encode runner_id}/jobs", query: options)
|
@@ -91,11 +105,17 @@ class Gitlab::Client
|
|
91
105
|
#
|
92
106
|
# @example
|
93
107
|
# Gitlab.project_runners(42)
|
108
|
+
# Gitlab.project_runners(42, type: 'instance_type', status: 'active')
|
109
|
+
# Gitlab.project_runners(42, tag_list: 'tag1,tag2')
|
94
110
|
#
|
95
111
|
# @param [Integer, String] id The ID or name of a project.
|
112
|
+
# @param [Hash] options A customizable set of options.
|
113
|
+
# @option options [String] :type(optional) The type of runners to show, one of: instance_type, group_type, project_type
|
114
|
+
# @option options [String] :status(optional) The status of runners to show, one of: active, paused, online, offline
|
115
|
+
# @option options [String] :tag_list(optional) List of the runners tags (separated by comma)
|
96
116
|
# @return [Array<Gitlab::ObjectifiedHash>]
|
97
|
-
def project_runners(project_id)
|
98
|
-
get("/projects/#{url_encode project_id}/runners")
|
117
|
+
def project_runners(project_id, options = {})
|
118
|
+
get("/projects/#{url_encode project_id}/runners", query: options)
|
99
119
|
end
|
100
120
|
|
101
121
|
# Enable an available specific runner in the project.
|
@@ -125,21 +145,39 @@ class Gitlab::Client
|
|
125
145
|
delete("/projects/#{url_encode id}/runners/#{runner_id}")
|
126
146
|
end
|
127
147
|
|
148
|
+
# List all runners (specific and shared) available in the group as well its ancestor groups. Shared runners are listed if at least one shared runner is defined.
|
149
|
+
# @see https://docs.gitlab.com/ee/api/runners.html#list-groups-runners
|
150
|
+
#
|
151
|
+
# @example
|
152
|
+
# Gitlab.group_runners(9)
|
153
|
+
# Gitlab.group_runners(9, type: 'instance_type', status: 'active')
|
154
|
+
# Gitlab.group_runners(9, tag_list: 'tag1,tag2')
|
155
|
+
#
|
156
|
+
# @param [Integer, String] id The ID or name of a project.
|
157
|
+
# @param [Hash] options A customizable set of options.
|
158
|
+
# @option options [String] :type(optional) The type of runners to show, one of: instance_type, group_type, project_type
|
159
|
+
# @option options [String] :status(optional) The status of runners to show, one of: active, paused, online, offline
|
160
|
+
# @option options [String] :tag_list(optional) List of the runners tags (separated by comma)
|
161
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
162
|
+
def group_runners(group, options = {})
|
163
|
+
get("/groups/#{url_encode group}/runners", query: options)
|
164
|
+
end
|
165
|
+
|
128
166
|
# Register a new Runner for the instance.
|
129
167
|
#
|
130
168
|
# @example
|
131
169
|
# Gitlab.register_runner('9142c16ea169eaaea3d752313a434a6e')
|
132
170
|
# Gitlab.register_runner('9142c16ea169eaaea3d752313a434a6e', description: 'Some Description', active: true, locked: false)
|
133
171
|
#
|
134
|
-
# @param [String] token Registration token.
|
172
|
+
# @param [String] token(required) Registration token.
|
135
173
|
# @param [Hash] options A customizable set of options.
|
136
|
-
# @option options [String] :description Runner description.
|
137
|
-
# @option options [Hash] :info Runner metadata.
|
138
|
-
# @option options [Boolean] :active Whether the Runner is active.
|
139
|
-
# @option options [Boolean] :locked Whether the Runner should be locked for current project.
|
140
|
-
# @option options [Boolean] :run_untagged Whether the Runner should handle untagged jobs.
|
141
|
-
# @option options [Array<String>] :tag_list List of Runner tags.
|
142
|
-
# @option options [Integer] :maximum_timeout Maximum timeout set when this Runner will handle the job.
|
174
|
+
# @option options [String] :description(optional) Runner description.
|
175
|
+
# @option options [Hash] :info(optional) Runner metadata.
|
176
|
+
# @option options [Boolean] :active(optional) Whether the Runner is active.
|
177
|
+
# @option options [Boolean] :locked(optional) Whether the Runner should be locked for current project.
|
178
|
+
# @option options [Boolean] :run_untagged(optional) Whether the Runner should handle untagged jobs.
|
179
|
+
# @option options [Array<String>] :tag_list(optional) List of Runner tags.
|
180
|
+
# @option options [Integer] :maximum_timeout(optional) Maximum timeout set when this Runner will handle the job.
|
143
181
|
# @return <Gitlab::ObjectifiedHash> Response against runner registration
|
144
182
|
def register_runner(token, options = {})
|
145
183
|
body = { token: token }.merge(options)
|