gitlab 4.8.0 → 4.13.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/README.md +13 -7
- data/lib/gitlab/cli.rb +0 -3
- data/lib/gitlab/cli_helpers.rb +11 -10
- data/lib/gitlab/client.rb +15 -0
- data/lib/gitlab/client/application_settings.rb +172 -0
- data/lib/gitlab/client/avatar.rb +21 -0
- data/lib/gitlab/client/boards.rb +56 -0
- data/lib/gitlab/client/build_variables.rb +14 -10
- data/lib/gitlab/client/commits.rb +18 -2
- data/lib/gitlab/client/container_registry.rb +85 -0
- data/lib/gitlab/client/epics.rb +73 -0
- data/lib/gitlab/client/features.rb +48 -0
- data/lib/gitlab/client/group_boards.rb +141 -0
- data/lib/gitlab/client/group_labels.rb +88 -0
- data/lib/gitlab/client/groups.rb +66 -2
- data/lib/gitlab/client/issue_links.rb +48 -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 +9 -8
- data/lib/gitlab/client/merge_requests.rb +12 -0
- data/lib/gitlab/client/notes.rb +1 -1
- data/lib/gitlab/client/pipelines.rb +12 -0
- data/lib/gitlab/client/project_clusters.rb +83 -0
- data/lib/gitlab/client/project_release_links.rb +76 -0
- data/lib/gitlab/client/project_releases.rb +79 -0
- data/lib/gitlab/client/projects.rb +27 -6
- data/lib/gitlab/client/repositories.rb +5 -3
- data/lib/gitlab/client/repository_files.rb +16 -0
- data/lib/gitlab/client/resource_label_events.rb +82 -0
- data/lib/gitlab/client/runners.rb +49 -2
- data/lib/gitlab/client/search.rb +66 -0
- data/lib/gitlab/client/users.rb +7 -9
- data/lib/gitlab/configuration.rb +1 -1
- data/lib/gitlab/error.rb +46 -1
- data/lib/gitlab/paginated_response.rb +19 -0
- data/lib/gitlab/request.rb +15 -25
- data/lib/gitlab/shell_history.rb +4 -8
- data/lib/gitlab/version.rb +1 -1
- metadata +33 -15
- data/.github/stale.yml +0 -18
- data/.gitignore +0 -22
- data/.rubocop_todo.yml +0 -46
- data/CONTRIBUTING.md +0 -195
- data/Gemfile +0 -6
- data/Rakefile +0 -15
- data/bin/console +0 -11
- data/bin/setup +0 -6
- data/gitlab.gemspec +0 -36
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.
|
@@ -80,6 +83,18 @@ class Gitlab::Client
|
|
80
83
|
get("/groups/#{url_encode team_id}/members/#{user_id}")
|
81
84
|
end
|
82
85
|
|
86
|
+
# Gets a list of merge requests of a group.
|
87
|
+
#
|
88
|
+
# @example
|
89
|
+
# Gitlab.group_merge_requests(5)
|
90
|
+
#
|
91
|
+
# @param [Integer, String] group_id The ID or name of a group.
|
92
|
+
# @param [Hash] options A customizable set of options.
|
93
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
94
|
+
def group_merge_requests(group, options = {})
|
95
|
+
get("/groups/#{group}/merge_requests", query: options)
|
96
|
+
end
|
97
|
+
|
83
98
|
# Adds a user to group.
|
84
99
|
#
|
85
100
|
# @example
|
@@ -191,5 +206,54 @@ class Gitlab::Client
|
|
191
206
|
def edit_group(id, options = {})
|
192
207
|
put("/groups/#{url_encode id}", body: options)
|
193
208
|
end
|
209
|
+
|
210
|
+
# Gets a list of issues of a group.
|
211
|
+
#
|
212
|
+
# @example
|
213
|
+
# Gitlab.group_issues(5)
|
214
|
+
#
|
215
|
+
# @param [Integer, String] group_id The ID or name of a group.
|
216
|
+
# @param [Hash] options A customizable set of options.
|
217
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
218
|
+
def group_issues(group, options = {})
|
219
|
+
get("/groups/#{group}/issues", query: options)
|
220
|
+
end
|
221
|
+
|
222
|
+
# Sync group with LDAP
|
223
|
+
#
|
224
|
+
# @example
|
225
|
+
# Gitlab.sync_ldap_group(1)
|
226
|
+
#
|
227
|
+
# @param [Integer] id The ID or name of a group.
|
228
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
229
|
+
def sync_ldap_group(id)
|
230
|
+
post("/groups/#{url_encode id}/ldap_sync")
|
231
|
+
end
|
232
|
+
|
233
|
+
# Add LDAP group link
|
234
|
+
#
|
235
|
+
# @example
|
236
|
+
# Gitlab.add_ldap_group_links(1, 'all', 50, 'ldap')
|
237
|
+
#
|
238
|
+
# @param [Integer] id The ID of a group
|
239
|
+
# @param [String] cn The CN of a LDAP group
|
240
|
+
# @param [Integer] group_access Minimum access level for members of the LDAP group.
|
241
|
+
# @param [String] provider LDAP provider for the LDAP group
|
242
|
+
# @return [Gitlab::ObjectifiedHash] Information about added ldap group link
|
243
|
+
def add_ldap_group_links(id, commonname, group_access, provider)
|
244
|
+
post("/groups/#{url_encode id}/ldap_group_links", body: { cn: commonname, group_access: group_access, provider: provider })
|
245
|
+
end
|
246
|
+
|
247
|
+
# Delete LDAP group link
|
248
|
+
#
|
249
|
+
# @example
|
250
|
+
# Gitlab.delete_ldap_group_links(1, 'all')
|
251
|
+
#
|
252
|
+
# @param [Integer] id The ID of a group
|
253
|
+
# @param [String] cn The CN of a LDAP group
|
254
|
+
# @return [Gitlab::ObjectifiedHash] Empty hash
|
255
|
+
def delete_ldap_group_links(id, commonname, provider)
|
256
|
+
delete("/groups/#{url_encode id}/ldap_group_links/#{url_encode provider}/#{url_encode commonname}")
|
257
|
+
end
|
194
258
|
end
|
195
259
|
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/labels.rb
CHANGED
@@ -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
|
@@ -37,11 +37,11 @@ class Gitlab::Client
|
|
37
37
|
# Gitlab.edit_project_approvers(1, {approver_ids: [5], approver_groups: [1]})
|
38
38
|
#
|
39
39
|
# @param [Integer] project(required) The ID of a project.
|
40
|
-
# @option options [Array] :approver_ids(
|
41
|
-
# @option options [Array] :approver_group_ids(
|
40
|
+
# @option options [Array] :approver_ids(required, nil if none) An array of User IDs that can approve MRs
|
41
|
+
# @option options [Array] :approver_group_ids(required, nil if none) An array of Group IDs whose members can approve MRs
|
42
42
|
# @return [Gitlab::ObjectifiedHash] MR approval configuration information about the project
|
43
43
|
def edit_project_approvers(project, options = {})
|
44
|
-
put("/projects/#{url_encode project}/
|
44
|
+
put("/projects/#{url_encode project}/approvers", body: options)
|
45
45
|
end
|
46
46
|
|
47
47
|
# Get Configuration for approvals on a specific Merge Request.
|
@@ -76,11 +76,11 @@ class Gitlab::Client
|
|
76
76
|
#
|
77
77
|
# @param [Integer] project(required) The ID of a project.
|
78
78
|
# @param [Integer] merge_request(required) The IID of a merge_request.
|
79
|
-
# @option options [Array] :approver_ids(
|
80
|
-
# @option options [Array] :approver_group_ids(
|
79
|
+
# @option options [Array] :approver_ids(required, nil if none) An array of User IDs that can approve MRs
|
80
|
+
# @option options [Array] :approver_group_ids(required, nil if none) An array of Group IDs whose members can approve MRs
|
81
81
|
# @return [Gitlab::ObjectifiedHash] MR approval configuration information about the project
|
82
82
|
def edit_merge_request_approvers(project, merge_request, options = {})
|
83
|
-
put("/projects/#{url_encode project}/merge_requests/#{merge_request}/
|
83
|
+
put("/projects/#{url_encode project}/merge_requests/#{merge_request}/approvers", body: options)
|
84
84
|
end
|
85
85
|
|
86
86
|
# Approve a merge request
|
@@ -104,9 +104,10 @@ class Gitlab::Client
|
|
104
104
|
#
|
105
105
|
# @param [Integer] project(required) The ID of a project.
|
106
106
|
# @param [Integer] merge_request(required) The IID of a merge request.
|
107
|
+
# @option options [String] :sudo(optional) The username of the user you want to remove the approval for
|
107
108
|
# @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")
|
109
|
+
def unapprove_merge_request(project, merge_request, options = {})
|
110
|
+
post("/projects/#{url_encode project}/merge_requests/#{merge_request}/unapprove", body: options)
|
110
111
|
end
|
111
112
|
end
|
112
113
|
end
|
@@ -55,6 +55,18 @@ class Gitlab::Client
|
|
55
55
|
get("/projects/#{url_encode project}/merge_requests/#{id}/pipelines")
|
56
56
|
end
|
57
57
|
|
58
|
+
# Get a list of merge request participants.
|
59
|
+
#
|
60
|
+
# @example
|
61
|
+
# Gitlab.merge_request_participants(5, 36)
|
62
|
+
#
|
63
|
+
# @param [Integer, String] project The ID or name of a project.
|
64
|
+
# @param [Integer] id The ID of a merge request.
|
65
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
66
|
+
def merge_request_participants(project, id)
|
67
|
+
get("/projects/#{url_encode project}/merge_requests/#{id}/participants")
|
68
|
+
end
|
69
|
+
|
58
70
|
# Creates a merge request.
|
59
71
|
#
|
60
72
|
# @example
|
data/lib/gitlab/client/notes.rb
CHANGED
@@ -276,7 +276,7 @@ class Gitlab::Client
|
|
276
276
|
# in the 'else'.
|
277
277
|
def note_content(body)
|
278
278
|
if body.is_a?(Hash)
|
279
|
-
|
279
|
+
warn 'Passing the note body as a Hash is deprecated. You should just pass the String.'
|
280
280
|
body
|
281
281
|
else
|
282
282
|
{ body: body }
|
@@ -77,5 +77,17 @@ class Gitlab::Client
|
|
77
77
|
def retry_pipeline(project, id)
|
78
78
|
post("/projects/#{url_encode project}/pipelines/#{id}/retry")
|
79
79
|
end
|
80
|
+
|
81
|
+
# Delete a pipeline
|
82
|
+
#
|
83
|
+
# @example
|
84
|
+
# Gitlab.delete_pipeline(5, 1)
|
85
|
+
#
|
86
|
+
# @param [Integer, String] project The ID or name of a project.
|
87
|
+
# @param [Integer] id The ID of a pipeline.
|
88
|
+
# @return [void] This API call returns an empty response body.
|
89
|
+
def delete_pipeline(project, id)
|
90
|
+
delete("/projects/#{url_encode project}/pipelines/#{id}")
|
91
|
+
end
|
80
92
|
end
|
81
93
|
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Gitlab::Client
|
4
|
+
# Defines methods related to project clusters.
|
5
|
+
# @see https://docs.gitlab.com/ce/api/project_clusters.html
|
6
|
+
module ProjectClusters
|
7
|
+
# Returns a list of project clusters.
|
8
|
+
#
|
9
|
+
# @example
|
10
|
+
# Gitlab.project_clusters(5)
|
11
|
+
#
|
12
|
+
# @param [Integer, String] project The ID or name of a project.
|
13
|
+
# @return [Array<Gitlab::ObjectifiedHash>] List of all clusters of a project
|
14
|
+
def project_clusters(project)
|
15
|
+
get("/projects/#{url_encode project}/clusters")
|
16
|
+
end
|
17
|
+
|
18
|
+
# Gets a single project cluster.
|
19
|
+
#
|
20
|
+
# @example
|
21
|
+
# Gitlab.project_cluster(5, 42)
|
22
|
+
#
|
23
|
+
# @param [Integer, String] project The ID or name of a project.
|
24
|
+
# @param [Integer] cluster_id The ID of the cluster.
|
25
|
+
# @return [Gitlab::ObjectifiedHash] Information about the requested cluster
|
26
|
+
def project_cluster(project, cluster_id)
|
27
|
+
get("/projects/#{url_encode project}/clusters/#{cluster_id}")
|
28
|
+
end
|
29
|
+
|
30
|
+
# Adds an existing Kubernetes cluster to the project.
|
31
|
+
#
|
32
|
+
# @example
|
33
|
+
# Gitlab.add_project_cluster(5, 'cluster-5', { enabled: false, platform_kubernetes_attributes: { api_url: 'https://35.111.51.20', token: '12345', ca_cert: "-----BEGIN CERTIFICATE-----\r\nhFiK1L61owwDQYJKoZIhvcNAQELBQAw\r\nLzEtMCsGA1UEAxMkZDA1YzQ1YjctNzdiMS00NDY0LThjNmEtMTQ0ZDJkZjM4ZDBj\r\nMB4XDTE4MTIyNzIwMDM1MVoXDTIzMTIyNjIxMDM1MVowLzEtMCsGA1UEAxMkZDA1\r\nYzQ1YjctNzdiMS00NDY0LThjNmEtMTQ0ZDJkZjM.......-----END CERTIFICATE-----", namespace: 'cluster-5-namespace', authorization_type: 'rbac' } })
|
34
|
+
# Gitlab.add_project_cluster(5, 'cluster-5', { platform_kubernetes_attributes: { api_url: 'https://35.111.51.20', token: '12345' } })
|
35
|
+
#
|
36
|
+
# @param [Integer, String] project The ID or name of a project.
|
37
|
+
# @param [String] name The name of the existing cluster.
|
38
|
+
# @param [Hash] options A customizable set of options.
|
39
|
+
# @option options [Boolean] :enabled(optional) Determines if cluster is active or not, defaults to true
|
40
|
+
# @option options [Hash] :platform_kubernetes_attributes A customizable set of Kubernetes platform attributes
|
41
|
+
# @suboption platform_kubernetes_attributes [String] :api_url(required) The URL to access the Kubernetes API
|
42
|
+
# @suboption platform_kubernetes_attributes [String] :token(required) The token to authenticate against Kubernetes
|
43
|
+
# @suboption platform_kubernetes_attributes [String] :ca_cert(optional) TLS certificate (needed if API is using a self-signed TLS certificate
|
44
|
+
# @suboption platform_kubernetes_attributes [String] :namespace(optional) The unique namespace related to the project
|
45
|
+
# @suboption platform_kubernetes_attributes [String] :authorization_type(optional) The cluster authorization type: rbac, abac or unknown_authorization. Defaults to rbac.
|
46
|
+
# @return [Gitlab::ObjectifiedHash] Information about the added project cluster.
|
47
|
+
def add_project_cluster(project, name, options = {})
|
48
|
+
body = { name: name }.merge(options)
|
49
|
+
post("/projects/#{url_encode project}/clusters/user", body: body)
|
50
|
+
end
|
51
|
+
|
52
|
+
# Updates an existing project cluster.
|
53
|
+
#
|
54
|
+
# @example
|
55
|
+
# Gitlab.edit_project_cluster(5, 1, { name: 'cluster-6', platform_kubernetes_attributes: { api_url: 'https://35.111.51.20', token: '12345', ca_cert: "-----BEGIN CERTIFICATE-----\r\nhFiK1L61owwDQYJKoZIhvcNAQELBQAw\r\nLzEtMCsGA1UEAxMkZDA1YzQ1YjctNzdiMS00NDY0LThjNmEtMTQ0ZDJkZjM4ZDBj\r\nMB4XDTE4MTIyNzIwMDM1MVoXDTIzMTIyNjIxMDM1MVowLzEtMCsGA1UEAxMkZDA1\r\nYzQ1YjctNzdiMS00NDY0LThjNmEtMTQ0ZDJkZjM.......-----END CERTIFICATE-----", namespace: 'cluster-6-namespace' } })
|
56
|
+
#
|
57
|
+
# @param [Integer, String] project The ID or name of a project.
|
58
|
+
# @param [Integer] cluster_id The ID of the cluster.
|
59
|
+
# @param [Hash] options A customizable set of options.
|
60
|
+
# @option options [String] :name(optional) The name of the cluster
|
61
|
+
# @option options [Hash] :platform_kubernetes_attributes A customizable set of Kubernetes platform attributes
|
62
|
+
# @suboption platform_kubernetes_attributes [String] :api_url(required) The URL to access the Kubernetes API
|
63
|
+
# @suboption platform_kubernetes_attributes [String] :token(required) The token to authenticate against Kubernetes
|
64
|
+
# @suboption platform_kubernetes_attributes [String] :ca_cert(optional) TLS certificate (needed if API is using a self-signed TLS certificate
|
65
|
+
# @suboption platform_kubernetes_attributes [String] :namespace(optional) The unique namespace related to the project
|
66
|
+
# @return [Gitlab::ObjectifiedHash] Information about the updated project cluster.
|
67
|
+
def edit_project_cluster(project, cluster_id, options = {})
|
68
|
+
put("/projects/#{url_encode project}/clusters/#{cluster_id}", body: options)
|
69
|
+
end
|
70
|
+
|
71
|
+
# Deletes an existing project cluster.
|
72
|
+
#
|
73
|
+
# @example
|
74
|
+
# Gitlab.delete_project_cluster(5, 42)
|
75
|
+
#
|
76
|
+
# @param [Integer, String] project The ID or name of a project.
|
77
|
+
# @param [Integer] cluster_id The ID of the cluster.
|
78
|
+
# @return [nil] This API call returns an empty response body.
|
79
|
+
def delete_project_cluster(project, cluster_id)
|
80
|
+
delete("/projects/#{url_encode project}/clusters/#{cluster_id}")
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Gitlab::Client
|
4
|
+
# Defines methods related to project release links.
|
5
|
+
# @see https://docs.gitlab.com/ce/api/releases/links.html
|
6
|
+
module ProjectReleaseLinks
|
7
|
+
# Get assets as links from a Release.
|
8
|
+
#
|
9
|
+
# @example
|
10
|
+
# Gitlab.project_release_links(5, 'v0.3')
|
11
|
+
#
|
12
|
+
# @param [Integer, String] project The ID or name of a project.
|
13
|
+
# @param [String] tag_name The tag associated with the Release.
|
14
|
+
# @return [Array<Gitlab::ObjectifiedHash>] List of assets as links from a Release.
|
15
|
+
def project_release_links(project, tag_name)
|
16
|
+
get("/projects/#{url_encode project}/releases/#{tag_name}/assets/links")
|
17
|
+
end
|
18
|
+
|
19
|
+
# Get an asset as link from a Release.
|
20
|
+
#
|
21
|
+
# @example
|
22
|
+
# Gitlab.project_release_link(5, 'v0.3', 1)
|
23
|
+
#
|
24
|
+
# @param [Integer, String] project The ID or name of a project.
|
25
|
+
# @param [String] tag_name The tag associated with the Release.
|
26
|
+
# @param [Integer] link_id The id of the link.
|
27
|
+
# @return [Gitlab::ObjectifiedHash] Information about the release link
|
28
|
+
def project_release_link(project, tag_name, link_id)
|
29
|
+
get("/projects/#{url_encode project}/releases/#{tag_name}/assets/links/#{link_id}")
|
30
|
+
end
|
31
|
+
|
32
|
+
# Create an asset as a link from a Release.
|
33
|
+
#
|
34
|
+
# @example
|
35
|
+
# Gitlab.create_project_release_link(5, 'v0.1', { name: 'awesome-v0.2.dmg', url: 'http://192.168.10.15:3000' })
|
36
|
+
#
|
37
|
+
# @param [Integer, String] project The ID or name of a project.
|
38
|
+
# @param [String] tag_name The tag associated with the Release.
|
39
|
+
# @param [Hash] options A customizable set of options.
|
40
|
+
# @option options [String] :name(required) The name of the link.
|
41
|
+
# @option options [String] :url(required) The URL of the link.
|
42
|
+
# @return [Gitlab::ObjectifiedHash] Information about the created release link.
|
43
|
+
def create_project_release_link(project, tag_name, options = {})
|
44
|
+
post("/projects/#{url_encode project}/releases/#{tag_name}/assets/links", body: options)
|
45
|
+
end
|
46
|
+
|
47
|
+
# Update an asset as a link from a Release. You have to specify at least one of name or url
|
48
|
+
#
|
49
|
+
# @example
|
50
|
+
# Gitlab.update_project_release_link(5, 'v0.3', 1, { name: 'awesome-v0.2.dmg', url: 'http://192.168.10.15:3000' })
|
51
|
+
#
|
52
|
+
# @param [Integer, String] project The ID or name of a project.
|
53
|
+
# @param [String] tag_name The tag where the release will be created from.
|
54
|
+
# @param [Integer] link_id The id of the link.
|
55
|
+
# @param [Hash] options A customizable set of options.
|
56
|
+
# @option options [String] :name(optional) The name of the link.
|
57
|
+
# @option options [String] :url(optional) The URL of the link.
|
58
|
+
# @return [Gitlab::ObjectifiedHash] Information about the updated release link.
|
59
|
+
def update_project_release_link(project, tag_name, link_id, options = {})
|
60
|
+
put("/projects/#{url_encode project}/releases/#{tag_name}/assets/links/#{link_id}", body: options)
|
61
|
+
end
|
62
|
+
|
63
|
+
# Delete an asset as a link from a Release.
|
64
|
+
#
|
65
|
+
# @example
|
66
|
+
# Gitlab.delete_project_release_link(5, 'v0.3', 1)
|
67
|
+
#
|
68
|
+
# @param [Integer, String] project The ID or name of a project.
|
69
|
+
# @param [String] tag_name The tag where the release will be created from.
|
70
|
+
# @param [Integer] link_id The id of the link.
|
71
|
+
# @return [Gitlab::ObjectifiedHash] Information about the deleted release link.
|
72
|
+
def delete_project_release_link(project, tag_name, link_id)
|
73
|
+
delete("/projects/#{url_encode project}/releases/#{tag_name}/assets/links/#{link_id}")
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Gitlab::Client
|
4
|
+
# Defines methods related to project releases.
|
5
|
+
# @see https://docs.gitlab.com/ce/api/releases/
|
6
|
+
module ProjectReleases
|
7
|
+
# Returns Paginated list of a project's releases, sorted by created_at.
|
8
|
+
#
|
9
|
+
# @example
|
10
|
+
# Gitlab.project_releases(5)
|
11
|
+
#
|
12
|
+
# @param [Integer, String] project The ID or name of a project.
|
13
|
+
# @return [Array<Gitlab::ObjectifiedHash>] Paginated list of Releases, sorted by created_at.
|
14
|
+
def project_releases(project)
|
15
|
+
get("/projects/#{url_encode project}/releases")
|
16
|
+
end
|
17
|
+
|
18
|
+
# Gets a Release by a tag name
|
19
|
+
#
|
20
|
+
# @example
|
21
|
+
# Gitlab.project_release(5, 'v0.1')
|
22
|
+
#
|
23
|
+
# @param [Integer, String] project The ID or name of a project.
|
24
|
+
# @param [String] tag_name The tag where the release will be created from..
|
25
|
+
# @return [Gitlab::ObjectifiedHash] Information about the release
|
26
|
+
def project_release(project, tag_name)
|
27
|
+
get("/projects/#{url_encode project}/releases/#{tag_name}")
|
28
|
+
end
|
29
|
+
|
30
|
+
# Creates a Release. You need push access to the repository to create a Release.
|
31
|
+
#
|
32
|
+
# @example
|
33
|
+
# Gitlab.create_project_release(5, { name: 'New Release', tag_name: 'v0.3', description: 'Super nice release' })
|
34
|
+
# Gitlab.create_project_release(5, { name: 'New Release', tag_name: 'v0.3', description: 'Super nice release', assets: { links: [{ name: 'hoge', url: 'https://google.com' }] } })
|
35
|
+
#
|
36
|
+
# @param [Integer, String] project The ID or name of a project.
|
37
|
+
# @param [Hash] options A customizable set of options.
|
38
|
+
# @option options [String] :name(required) The release name.
|
39
|
+
# @option options [String] :tag_name(required) The tag where the release will be created from.
|
40
|
+
# @option options [String] :description(required) The description of the release. You can use markdown.
|
41
|
+
# @option options [String] :ref(optional) If tag_name does not exist, the release will be created from ref. It can be a commit SHA, another tag name, or a branch name.
|
42
|
+
# @option options [Hash] :assets(optional) A customizable set of options for release assets
|
43
|
+
# @asset assets [Array<link>] :links(optional) An array of assets links as hashes.
|
44
|
+
# @link links [Hash] link_elements A combination of a link name and a link url
|
45
|
+
# @link_element [String] :name The name of the link.
|
46
|
+
# @link_element [String] :url The url of the link.
|
47
|
+
# @return [Gitlab::ObjectifiedHash] Information about the created release.
|
48
|
+
def create_project_release(project, options = {})
|
49
|
+
post("/projects/#{url_encode project}/releases", body: options)
|
50
|
+
end
|
51
|
+
|
52
|
+
# Updates a release.
|
53
|
+
#
|
54
|
+
# @example
|
55
|
+
# Gitlab.update_project_release(5, 'v0.3', { name: 'New Release', description: 'Super nice release' })
|
56
|
+
#
|
57
|
+
# @param [Integer, String] project The ID or name of a project.
|
58
|
+
# @param [String] tag_name The tag where the release will be created from.
|
59
|
+
# @param [Hash] options A customizable set of options.
|
60
|
+
# @option options [String] :name(optional) The release name.
|
61
|
+
# @option options [String] :description(optional) The description of the release. You can use markdown.
|
62
|
+
# @return [Gitlab::ObjectifiedHash] Information about the updated release.
|
63
|
+
def update_project_release(project, tag_name, options = {})
|
64
|
+
put("/projects/#{url_encode project}/releases/#{tag_name}", body: options)
|
65
|
+
end
|
66
|
+
|
67
|
+
# Delete a Release. Deleting a Release will not delete the associated tag.
|
68
|
+
#
|
69
|
+
# @example
|
70
|
+
# Gitlab.delete_project_release(5, 'v0.3')
|
71
|
+
#
|
72
|
+
# @param [Integer, String] project The ID or name of a project.
|
73
|
+
# @param [String] tag_name The tag where the release will be created from.
|
74
|
+
# @return [Gitlab::ObjectifiedHash] Information about the deleted release.
|
75
|
+
def delete_project_release(project, tag_name)
|
76
|
+
delete("/projects/#{url_encode project}/releases/#{tag_name}")
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|