gitlab 4.10.0 → 4.19.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.
- checksums.yaml +4 -4
- data/LICENSE.txt +1 -1
- data/README.md +26 -18
- data/lib/gitlab/api.rb +2 -0
- data/lib/gitlab/cli.rb +6 -8
- data/lib/gitlab/cli_helpers.rb +20 -25
- data/lib/gitlab/client/application_settings.rb +172 -0
- data/lib/gitlab/client/build_variables.rb +17 -12
- data/lib/gitlab/client/commits.rb +42 -5
- data/lib/gitlab/client/container_registry.rb +85 -0
- 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 +153 -2
- data/lib/gitlab/client/issue_links.rb +48 -0
- data/lib/gitlab/client/issues.rb +1 -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/lint.rb +19 -0
- data/lib/gitlab/client/markdown.rb +23 -0
- data/lib/gitlab/client/merge_request_approvals.rb +160 -7
- data/lib/gitlab/client/merge_requests.rb +64 -4
- data/lib/gitlab/client/notes.rb +28 -1
- data/lib/gitlab/client/packages.rb +95 -0
- data/lib/gitlab/client/pipeline_schedules.rb +16 -4
- data/lib/gitlab/client/pipelines.rb +12 -0
- data/lib/gitlab/client/projects.rb +142 -8
- data/lib/gitlab/client/remote_mirrors.rb +51 -0
- data/lib/gitlab/client/repositories.rb +59 -3
- 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 +99 -14
- data/lib/gitlab/client/search.rb +5 -1
- data/lib/gitlab/client/user_snippets.rb +114 -0
- data/lib/gitlab/client/users.rb +142 -11
- data/lib/gitlab/client.rb +18 -2
- data/lib/gitlab/configuration.rb +1 -1
- data/lib/gitlab/error.rb +54 -0
- data/lib/gitlab/help.rb +8 -8
- data/lib/gitlab/objectified_hash.rb +23 -7
- data/lib/gitlab/page_links.rb +1 -1
- data/lib/gitlab/paginated_response.rb +23 -20
- data/lib/gitlab/request.rb +34 -33
- data/lib/gitlab/shell_history.rb +6 -10
- data/lib/gitlab/version.rb +1 -1
- data/lib/gitlab.rb +14 -6
- metadata +24 -47
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Gitlab::Client
|
4
|
+
# Defines methods related to lint/validations.
|
5
|
+
# @see https://docs.gitlab.com/ce/api/lint.html
|
6
|
+
module Lint
|
7
|
+
# Checks if your .gitlab-ci.yml file is valid.
|
8
|
+
#
|
9
|
+
# @example
|
10
|
+
# Gitlab.validate_gitlab_ci_yml("{ \"image\": \"ruby:2.6\", \"services\": [\"postgres\"], \"before_script\": [\"bundle install\", \"bundle exec rake db:create\"], \"variables\": {\"DB_NAME\": \"postgres\"}, \"types\": [\"test\", \"deploy\", \"notify\"], \"rspec\": { \"script\": \"rake spec\", \"tags\": [\"ruby\", \"postgres\"], \"only\": [\"branches\"]}}")
|
11
|
+
#
|
12
|
+
# @param [String] content the .gitlab-ci.yaml content.
|
13
|
+
# @return <Gitlab::ObjectifiedHash> Returns information about validity of the yml.
|
14
|
+
def validate_gitlab_ci_yml(content)
|
15
|
+
body = { content: content }
|
16
|
+
post('/lint', body: body)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Gitlab::Client
|
4
|
+
# Defines methods related to markdown.
|
5
|
+
# @see https://docs.gitlab.com/ce/api/markdown.html
|
6
|
+
module Markdown
|
7
|
+
# Render an arbitrary Markdown document
|
8
|
+
#
|
9
|
+
# @example
|
10
|
+
# Gitlab.markdown('Hello world! :tada:')
|
11
|
+
# Gitlab.markdown('Hello world! :tada:', gfm: true, project: 'group_example/project_example')
|
12
|
+
#
|
13
|
+
# @param [String] text The markdown text to render.
|
14
|
+
# @param [Hash] options A customizable set of options.
|
15
|
+
# @option options [Boolean] :gfm(optional) Render text using GitLab Flavored Markdown. Default is false.
|
16
|
+
# @option options [String] :project(optional) Use project as a context when creating references using GitLab Flavored Markdown. Authentication is required if a project is not public.
|
17
|
+
# @return <Gitlab::ObjectifiedHash> Returns the rendered markdown as response
|
18
|
+
def markdown(text, options = {})
|
19
|
+
body = { text: text }.merge(options)
|
20
|
+
post('/markdown', body: body)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -31,17 +31,75 @@ 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
|
91
|
+
# @deprecated Since Gitlab 13.12 /approvers endpoints are removed!!!
|
92
|
+
# See Gitlab.create_project_merge_request_approval_rule
|
35
93
|
#
|
36
94
|
# @example
|
37
95
|
# Gitlab.edit_project_approvers(1, {approver_ids: [5], approver_groups: [1]})
|
38
96
|
#
|
39
97
|
# @param [Integer] project(required) The ID of a project.
|
40
|
-
# @option options [Array] :approver_ids(
|
41
|
-
# @option options [Array] :approver_group_ids(
|
98
|
+
# @option options [Array] :approver_ids(required, nil if none) An array of User IDs that can approve MRs
|
99
|
+
# @option options [Array] :approver_group_ids(required, nil if none) An array of Group IDs whose members can approve MRs
|
42
100
|
# @return [Gitlab::ObjectifiedHash] MR approval configuration information about the project
|
43
101
|
def edit_project_approvers(project, options = {})
|
44
|
-
put("/projects/#{url_encode project}/
|
102
|
+
put("/projects/#{url_encode project}/approvers", body: options)
|
45
103
|
end
|
46
104
|
|
47
105
|
# Get Configuration for approvals on a specific Merge Request.
|
@@ -70,19 +128,101 @@ class Gitlab::Client
|
|
70
128
|
end
|
71
129
|
|
72
130
|
# Change allowed approvers and approver groups for a merge request
|
131
|
+
# @deprecated Since Gitlab 13.12 /approvers endpoints are removed!!!
|
132
|
+
# See Gitlab.create_merge_request_level_rule
|
73
133
|
#
|
74
134
|
# @example
|
75
135
|
# Gitlab.edit_merge_request_approvers(1, 5, {approver_ids: [5], approver_groups: [1]})
|
76
136
|
#
|
77
137
|
# @param [Integer] project(required) The ID of a project.
|
78
138
|
# @param [Integer] merge_request(required) The IID of a merge_request.
|
79
|
-
# @option options [Array] :approver_ids(
|
80
|
-
# @option options [Array] :approver_group_ids(
|
139
|
+
# @option options [Array] :approver_ids(required, nil if none) An array of User IDs that can approve MRs
|
140
|
+
# @option options [Array] :approver_group_ids(required, nil if none) An array of Group IDs whose members can approve MRs
|
81
141
|
# @return [Gitlab::ObjectifiedHash] MR approval configuration information about the project
|
82
142
|
def edit_merge_request_approvers(project, merge_request, options = {})
|
83
143
|
put("/projects/#{url_encode project}/merge_requests/#{merge_request}/approvers", body: options)
|
84
144
|
end
|
85
145
|
|
146
|
+
# Create merge request level rule
|
147
|
+
#
|
148
|
+
# @example
|
149
|
+
# Gitlab.create_merge_request_level_rule(1, 2, {
|
150
|
+
# name: "devs",
|
151
|
+
# approvals_required: 2,
|
152
|
+
# approval_project_rule_id: 99,
|
153
|
+
# user_ids: [3, 4],
|
154
|
+
# group_ids: [5, 6],
|
155
|
+
# })
|
156
|
+
#
|
157
|
+
# Important: When approval_project_rule_id is set, the name, users and groups of project-level rule are copied.
|
158
|
+
# The approvals_required specified is used.
|
159
|
+
#
|
160
|
+
# @param [Integer] project(required) The ID of a project.
|
161
|
+
# @param [Integer] merge_request(required) The IID of a merge request.
|
162
|
+
# @option options [String] :name(required) The name of the approval rule
|
163
|
+
# @option options [Integer] :approvals_required(required) The number of required approvals for this rule
|
164
|
+
# @option options [Integer] :approval_project_rule_id(optional) The ID of a project-level approval rule
|
165
|
+
# @option options [Array] :user_ids(optional) The ids of users as approvers
|
166
|
+
# @option options [Array] :group_ids(optional) The ids of groups as approvers
|
167
|
+
# @return [Gitlab::ObjectifiedHash] New MR level approval rule
|
168
|
+
def create_merge_request_level_rule(project, merge_request, options = {})
|
169
|
+
post("/projects/#{url_encode project}/merge_requests/#{merge_request}/approval_rules", body: options)
|
170
|
+
end
|
171
|
+
|
172
|
+
# Get merge request level rule
|
173
|
+
#
|
174
|
+
# @example
|
175
|
+
# Gitlab.merge_request_level_rule(1, 2)
|
176
|
+
#
|
177
|
+
# @param [Integer] project(required) The ID of a project.
|
178
|
+
# @param [Integer] merge_request(required) The IID of a merge request.
|
179
|
+
# @return [Gitlab::ObjectifiedHash] New MR level approval rule
|
180
|
+
def merge_request_level_rule(project, merge_request)
|
181
|
+
get("/projects/#{url_encode project}/merge_requests/#{merge_request}/approval_rules")
|
182
|
+
end
|
183
|
+
|
184
|
+
# Update merge request level rule
|
185
|
+
#
|
186
|
+
# @example
|
187
|
+
# Gitlab.update_merge_request_level_rule(1, 2, 69, {
|
188
|
+
# name: "devs",
|
189
|
+
# approvals_required: 2,
|
190
|
+
# user_ids: [3, 4],
|
191
|
+
# group_ids: [5, 6],
|
192
|
+
# })
|
193
|
+
#
|
194
|
+
# Important: Approvers and groups not in the users/groups parameters are removed
|
195
|
+
# Important: Updating a report_approver or code_owner rule is not allowed.
|
196
|
+
# These are system generated rules.
|
197
|
+
#
|
198
|
+
# @param [Integer] project(required) The ID of a project.
|
199
|
+
# @param [Integer] merge_request(required) The IID of a merge request.
|
200
|
+
# @param [Integer] appr_rule_id(required) The ID of a approval rule
|
201
|
+
# @option options [String] :name(required) The name of the approval rule
|
202
|
+
# @option options [Integer] :approvals_required(required) The number of required approvals for this rule
|
203
|
+
# @option options [Array] :user_ids(optional) The ids of users as approvers
|
204
|
+
# @option options [Array] :group_ids(optional) The ids of groups as approvers
|
205
|
+
# @return [Gitlab::ObjectifiedHash] Updated MR level approval rule
|
206
|
+
def update_merge_request_level_rule(project, merge_request, appr_rule_id, options = {})
|
207
|
+
put("/projects/#{url_encode project}/merge_requests/#{merge_request}/approval_rules/#{appr_rule_id}", body: options)
|
208
|
+
end
|
209
|
+
|
210
|
+
# Delete merge request level rule
|
211
|
+
#
|
212
|
+
# @example
|
213
|
+
# Gitlab.delete_merge_request_level_rule(1, 2, 69)
|
214
|
+
#
|
215
|
+
# Important: Deleting a report_approver or code_owner rule is not allowed.
|
216
|
+
# These are system generated rules.
|
217
|
+
#
|
218
|
+
# @param [Integer] project(required) The ID of a project.
|
219
|
+
# @param [Integer] merge_request(required) The IID of a merge request.
|
220
|
+
# @param [Integer] appr_rule_id(required) The ID of a approval rule
|
221
|
+
# @return [void] This API call returns an empty response body
|
222
|
+
def delete_merge_request_level_rule(project, merge_request, appr_rule_id)
|
223
|
+
delete("/projects/#{url_encode project}/merge_requests/#{merge_request}/approval_rules/#{appr_rule_id}")
|
224
|
+
end
|
225
|
+
|
86
226
|
# Approve a merge request
|
87
227
|
#
|
88
228
|
# @example
|
@@ -104,9 +244,22 @@ class Gitlab::Client
|
|
104
244
|
#
|
105
245
|
# @param [Integer] project(required) The ID of a project.
|
106
246
|
# @param [Integer] merge_request(required) The IID of a merge request.
|
247
|
+
# @option options [String] :sudo(optional) The username of the user you want to remove the approval for
|
107
248
|
# @return [void] This API call returns an empty response body.
|
108
|
-
def unapprove_merge_request(project, merge_request)
|
109
|
-
post("/projects/#{url_encode project}/merge_requests/#{merge_request}/unapprove")
|
249
|
+
def unapprove_merge_request(project, merge_request, options = {})
|
250
|
+
post("/projects/#{url_encode project}/merge_requests/#{merge_request}/unapprove", body: options)
|
251
|
+
end
|
252
|
+
|
253
|
+
# Get the approval state of merge requests
|
254
|
+
#
|
255
|
+
# @example
|
256
|
+
# Gitlab.merge_request_approval_state(5, 36)
|
257
|
+
#
|
258
|
+
# @param [Integer, String] project The ID or name of a project.
|
259
|
+
# @param [Integer] id The ID of a merge request.
|
260
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
261
|
+
def merge_request_approval_state(project, id)
|
262
|
+
get("/projects/#{url_encode project}/merge_requests/#{id}/approval_state")
|
110
263
|
end
|
111
264
|
end
|
112
265
|
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.
|
@@ -55,6 +59,25 @@ class Gitlab::Client
|
|
55
59
|
get("/projects/#{url_encode project}/merge_requests/#{id}/pipelines")
|
56
60
|
end
|
57
61
|
|
62
|
+
# Create a new pipeline for a merge request.
|
63
|
+
# A pipeline created via this endpoint doesnt run a regular branch/tag pipeline.
|
64
|
+
# It requires .gitlab-ci.yml to be configured with only: [merge_requests] to create jobs.
|
65
|
+
#
|
66
|
+
# The new pipeline can be:
|
67
|
+
#
|
68
|
+
# A detached merge request pipeline.
|
69
|
+
# A pipeline for merged results if the project setting is enabled.
|
70
|
+
#
|
71
|
+
# @example
|
72
|
+
# Gitlab.create_merge_request_pipeline(5, 36)
|
73
|
+
#
|
74
|
+
# @param [Integer, String] project The ID or name of a project.
|
75
|
+
# @param [Integer] iid The internal ID of a merge request.
|
76
|
+
# @return [Gitlab::ObjectifiedHash]
|
77
|
+
def create_merge_request_pipeline(project, iid)
|
78
|
+
post("/projects/#{url_encode project}/merge_requests/#{iid}/pipelines")
|
79
|
+
end
|
80
|
+
|
58
81
|
# Get a list of merge request participants.
|
59
82
|
#
|
60
83
|
# @example
|
@@ -81,8 +104,14 @@ class Gitlab::Client
|
|
81
104
|
# @option options [String] :source_branch (required) The source branch name.
|
82
105
|
# @option options [String] :target_branch (required) The target branch name.
|
83
106
|
# @option options [Integer] :assignee_id (optional) The ID of a user to assign merge request.
|
107
|
+
# @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.
|
108
|
+
# @option options [String] :description (optional) Description of MR. Limited to 1,048,576 characters.
|
84
109
|
# @option options [Integer] :target_project_id (optional) The target project ID.
|
85
110
|
# @option options [String] :labels (optional) Labels as a comma-separated list.
|
111
|
+
# @option options [Integer] :milestone_id (optional) The global ID of a milestone
|
112
|
+
# @option options [Boolean] :remove_source_branch (optional) Flag indicating if a merge request should remove the source branch when merging
|
113
|
+
# @option options [Boolean] :allow_collaboration (optional) Allow commits from members who can merge to the target branch
|
114
|
+
# @option options [Boolean] :squash (optional) Squash commits into a single commit when merging
|
86
115
|
# @return [Gitlab::ObjectifiedHash] Information about created merge request.
|
87
116
|
def create_merge_request(project, title, options = {})
|
88
117
|
body = { title: title }.merge(options)
|
@@ -115,7 +144,12 @@ class Gitlab::Client
|
|
115
144
|
# @param [Integer, String] project The ID or name of a project.
|
116
145
|
# @param [Integer] id The ID of a merge request.
|
117
146
|
# @param [Hash] options A customizable set of options.
|
118
|
-
# @option options [String] :merge_commit_message Custom merge commit message
|
147
|
+
# @option options [String] :merge_commit_message(optional) Custom merge commit message
|
148
|
+
# @option options [String] :squash_commit_message(optional) Custom squash commit message
|
149
|
+
# @option options [Boolean] :squash(optional) if true the commits will be squashed into a single commit on merge
|
150
|
+
# @option options [Boolean] :should_remove_source_branch(optional) if true removes the source branch
|
151
|
+
# @option options [Boolean] :merge_when_pipeline_succeeds(optional) if true the MR is merged when the pipeline succeeds
|
152
|
+
# @option options [String] :sha(optional) if present, then this SHA must match the HEAD of the source branch, otherwise the merge will fail
|
119
153
|
# @return [Gitlab::ObjectifiedHash] Information about updated merge request.
|
120
154
|
def accept_merge_request(project, id, options = {})
|
121
155
|
put("/projects/#{url_encode project}/merge_requests/#{id}/merge", body: options)
|
@@ -153,7 +187,7 @@ class Gitlab::Client
|
|
153
187
|
# @param [Integer] project The ID of a project
|
154
188
|
# @param [Integer] iid The internal ID of a merge request
|
155
189
|
def merge_request_closes_issues(project_id, merge_request_iid)
|
156
|
-
get("/projects/#{project_id}/merge_requests/#{merge_request_iid}/closes_issues")
|
190
|
+
get("/projects/#{url_encode project_id}/merge_requests/#{merge_request_iid}/closes_issues")
|
157
191
|
end
|
158
192
|
|
159
193
|
# Subscribes to a merge request.
|
@@ -298,6 +332,18 @@ class Gitlab::Client
|
|
298
332
|
delete("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/discussions/#{discussion_id}/notes/#{note_id}")
|
299
333
|
end
|
300
334
|
|
335
|
+
# Delete a merge request
|
336
|
+
#
|
337
|
+
# @example
|
338
|
+
# Gitlab.delete_merge_request(5, 1)
|
339
|
+
# Gitlab.delete_merge_request('gitlab', 1)
|
340
|
+
# @param [Integer, String] project The ID or name of a project.
|
341
|
+
# @param [Integer] id The ID of a merge request.
|
342
|
+
# @return [Gitlab::ObjectifiedHash] An empty response.
|
343
|
+
def delete_merge_request(project, merge_request_id)
|
344
|
+
delete("/projects/#{url_encode project}/merge_requests/#{merge_request_id}")
|
345
|
+
end
|
346
|
+
|
301
347
|
# Gets a list of merge request diff versions
|
302
348
|
#
|
303
349
|
# @example
|
@@ -322,5 +368,19 @@ class Gitlab::Client
|
|
322
368
|
def merge_request_diff_version(project, merge_request_id, version_id)
|
323
369
|
get("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/versions/#{version_id}")
|
324
370
|
end
|
371
|
+
|
372
|
+
# Rebase a merge request.
|
373
|
+
#
|
374
|
+
# @example
|
375
|
+
# Gitlab.rebase_merge_request(5, 42, { skip_ci: true })
|
376
|
+
#
|
377
|
+
# @param [Integer, String] project The ID or name of a project.
|
378
|
+
# @param [Integer] id The ID of a merge request.
|
379
|
+
# @param [Hash] options A customizable set of options.
|
380
|
+
# @option options [String] :skip_ci Set to true to skip creating a CI pipeline
|
381
|
+
# @return [Gitlab::ObjectifiedHash] Rebase progress status
|
382
|
+
def rebase_merge_request(project, id, options = {})
|
383
|
+
put("/projects/#{url_encode project}/merge_requests/#{id}/rebase", body: options)
|
384
|
+
end
|
325
385
|
end
|
326
386
|
end
|
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
|
@@ -276,7 +303,7 @@ class Gitlab::Client
|
|
276
303
|
# in the 'else'.
|
277
304
|
def note_content(body)
|
278
305
|
if body.is_a?(Hash)
|
279
|
-
|
306
|
+
warn 'Passing the note body as a Hash is deprecated. You should just pass the String.'
|
280
307
|
body
|
281
308
|
else
|
282
309
|
{ body: body }
|
@@ -0,0 +1,95 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Gitlab::Client
|
4
|
+
# Defines methods related to GitLab Packages.
|
5
|
+
# @see https://docs.gitlab.com/ee/api/packages.html
|
6
|
+
module Packages
|
7
|
+
# Gets a list of project packages.
|
8
|
+
#
|
9
|
+
# @example
|
10
|
+
# Gitlab.project_packages(5)
|
11
|
+
# Gitlab.project_packages(5, { package_type: 'npm', sort: 'desc' })
|
12
|
+
#
|
13
|
+
# @param [Integer, String] :project the ID or name of a project.
|
14
|
+
# @param [Hash] options A customizable set of options.
|
15
|
+
# @options options [String] :order_by The field to use as order. One of created_at (default), name, version, or type.
|
16
|
+
# @options options [String] :sort The direction of the order, either asc (default) for ascending order or desc for descending order.
|
17
|
+
# @options options [String] :package_type Filter the returned packages by type. One of conan, maven, npm, pypi, composer, nuget, helm, terraform_module, or golang.
|
18
|
+
# @options options [String] :package_name Filter the project packages with a fuzzy search by name.
|
19
|
+
# @options options [String] :include_versionless When set to true, versionless packages are included in the response.
|
20
|
+
# @options options [String] :status Filter the returned packages by status. One of default (default), hidden, processing, error, or pending_destruction.
|
21
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
22
|
+
def project_packages(project, options = {})
|
23
|
+
get("/projects/#{url_encode project}/packages", query: options)
|
24
|
+
end
|
25
|
+
|
26
|
+
# Gets a list of project packages.
|
27
|
+
#
|
28
|
+
# @example
|
29
|
+
# Gitlab.group_packages(5)
|
30
|
+
# Gitlab.group_packages(5, { package_type: 'npm', sort: 'desc' })
|
31
|
+
#
|
32
|
+
# @param [Integer, String] project the ID or name of a project.
|
33
|
+
# @param [Hash] options A customizable set of options.
|
34
|
+
# @options options [String] :exclude_subgroups If the parameter is included as true, packages from projects from subgroups are not listed. Default is false.
|
35
|
+
# @options options [String] :order_by The field to use as order. One of created_at (default), name, version, or type.
|
36
|
+
# @options options [String] :sort The direction of the order, either asc (default) for ascending order or desc for descending order.
|
37
|
+
# @options options [String] :package_type Filter the returned packages by type. One of conan, maven, npm, pypi, composer, nuget, helm, terraform_module, or golang.
|
38
|
+
# @options options [String] :package_name Filter the project packages with a fuzzy search by name.
|
39
|
+
# @options options [String] :include_versionless When set to true, versionless packages are included in the response.
|
40
|
+
# @options options [String] :status Filter the returned packages by status. One of default (default), hidden, processing, error, or pending_destruction.
|
41
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
42
|
+
def group_packages(group, options = {})
|
43
|
+
get("/groups/#{url_encode group}/packages", query: options)
|
44
|
+
end
|
45
|
+
|
46
|
+
# Get a single project package.
|
47
|
+
#
|
48
|
+
# @example
|
49
|
+
# Gitlab.project_package(5, 3)
|
50
|
+
#
|
51
|
+
# @param [Integer, String] project The ID or name of a project.
|
52
|
+
# @param [Integer] id ID of a package.
|
53
|
+
# @return [Gitlab::ObjectifiedHash]
|
54
|
+
def project_package(project, id)
|
55
|
+
get("/projects/#{url_encode project}/packages/#{id}")
|
56
|
+
end
|
57
|
+
|
58
|
+
# Get a list of package files of a single package.
|
59
|
+
#
|
60
|
+
# @example
|
61
|
+
# Gitlab.project_package_files(5, 3)
|
62
|
+
#
|
63
|
+
# @param [Integer, String] project The ID or name of a project.
|
64
|
+
# @param [Integer] id ID of a package.
|
65
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
66
|
+
def project_package_files(project, id)
|
67
|
+
get("/projects/#{url_encode project}/packages/#{id}/package_files")
|
68
|
+
end
|
69
|
+
|
70
|
+
# Deletes a project package.
|
71
|
+
#
|
72
|
+
# @example
|
73
|
+
# Gitlab.delete_project_package(5, 3)
|
74
|
+
#
|
75
|
+
# @param [Integer, String] project The ID or name of a project.
|
76
|
+
# @param [Integer] id ID of a package.
|
77
|
+
# @return [void] This API call returns an empty response body.
|
78
|
+
def delete_project_package(project, id)
|
79
|
+
delete("/projects/#{url_encode project}/packages/#{id}")
|
80
|
+
end
|
81
|
+
|
82
|
+
# Delete a package file.
|
83
|
+
#
|
84
|
+
# @example
|
85
|
+
# Gitlab.delete_project_file(5, 3, 1)
|
86
|
+
#
|
87
|
+
# @param [Integer, String] project The ID or name of a project.
|
88
|
+
# @param [Integer] package_id ID of a package.
|
89
|
+
# @param [Integer] file_id ID of a package file.
|
90
|
+
# @return [void] This API call returns an empty response body.
|
91
|
+
def delete_project_package_file(project, package_id, file_id)
|
92
|
+
delete("/projects/#{url_encode project}/packages/#{package_id}/package_files/#{file_id}")
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
@@ -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.
|
@@ -77,6 +77,18 @@ class Gitlab::Client
|
|
77
77
|
post("/projects/#{url_encode project}/pipeline_schedules/#{pipeline_schedule_id}/take_ownership")
|
78
78
|
end
|
79
79
|
|
80
|
+
# Run a scheduled pipeline immediately.
|
81
|
+
#
|
82
|
+
# @example
|
83
|
+
# Gitlab.run_pipeline_schedule(5, 1)
|
84
|
+
#
|
85
|
+
# @param [Integer, String] project The ID or name of a project.
|
86
|
+
# @param [Integer] trigger_id The pipeline schedule ID.
|
87
|
+
# @return [Gitlab::ObjectifiedHash] Pipeline created message.
|
88
|
+
def run_pipeline_schedule(project, pipeline_schedule_id)
|
89
|
+
post("/projects/#{url_encode project}/pipeline_schedules/#{pipeline_schedule_id}/play")
|
90
|
+
end
|
91
|
+
|
80
92
|
# Delete a pipeline schedule.
|
81
93
|
#
|
82
94
|
# @example
|
@@ -101,7 +113,7 @@ class Gitlab::Client
|
|
101
113
|
# @option options [String] :value The value of a variable
|
102
114
|
# @return [Array<Gitlab::ObjectifiedHash>] The created pipeline schedule variable.
|
103
115
|
def create_pipeline_schedule_variable(project, pipeline_schedule_id, options = {})
|
104
|
-
post("/projects/#{url_encode project}/pipeline_schedules/#{pipeline_schedule_id}/variables",
|
116
|
+
post("/projects/#{url_encode project}/pipeline_schedules/#{pipeline_schedule_id}/variables", body: options)
|
105
117
|
end
|
106
118
|
|
107
119
|
# Updates the variable of a pipeline schedule.
|
@@ -116,7 +128,7 @@ class Gitlab::Client
|
|
116
128
|
# @option options [String] :value The value of a variable.
|
117
129
|
# @return [Array<Gitlab::ObjectifiedHash>] The updated pipeline schedule variable.
|
118
130
|
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}",
|
131
|
+
put("/projects/#{url_encode project}/pipeline_schedules/#{pipeline_schedule_id}/variables/#{url_encode key}", body: options)
|
120
132
|
end
|
121
133
|
|
122
134
|
# 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
|