gitlab 4.10.0 → 4.11.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1ffd49c727596fb28465bceabb3674b310772840169be0b80cacfbd2a415e266
4
- data.tar.gz: 0f1ca4531f96bf17b640880089db77284336b69832fa5bbab31d35d60c128e4f
3
+ metadata.gz: 507d4fdc41c5f184840d8831d07c3127220f813c2ff52d8f061b82b579515d2a
4
+ data.tar.gz: 8e84cda29938364f23063f6762d15d7d0a3f4b81a2cdfb5a7a8fcba56cd1071f
5
5
  SHA512:
6
- metadata.gz: f758f2a0b714d8ef390cb65ebe39d7fbc48f4e3230b252e79ee82ec4e5f0e352e4499fdf6df0f913f4799ccb3db4caaecfd5ed9a37463a330b4593d147de0494
7
- data.tar.gz: 879cc8c1b0432435c3868dde4ad0f943875c8b719021f7c8b5965a775db8b3172ab0b239daa643b1e7f8575519ba5cf60963f7c2c2c858ec93e592e687bb89c3
6
+ metadata.gz: '04025787441bfba125d1f60c918e9fb01cbe215f4bdddfcca56253201237e73fdd18153117e49c91147089436b923106853b9a43548463ebb5a3c6764b1fecac'
7
+ data.tar.gz: 7a3e9cf4f21b93ce1eb8ddf0fc413aab2f3a7e48f2da53455e174ead9ea208da503b1418cd1f20a3c6913a93bf4be5d2aff5bcbb17a4036d54216c05f04d0be6
@@ -15,6 +15,7 @@ module Gitlab
15
15
  include BuildVariables
16
16
  include Builds
17
17
  include Commits
18
+ include ContainerRegistry
18
19
  include Deployments
19
20
  include Environments
20
21
  include Events
@@ -27,6 +28,8 @@ module Gitlab
27
28
  include Jobs
28
29
  include Keys
29
30
  include Labels
31
+ include Lint
32
+ include Markdown
30
33
  include MergeRequestApprovals
31
34
  include MergeRequests
32
35
  include Milestones
@@ -0,0 +1,85 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Gitlab::Client
4
+ # Defines methods related to GitLab Container Registry.
5
+ # @see https://docs.gitlab.com/ce/api/container_registry.html
6
+ module ContainerRegistry
7
+ # Get a list of registry repositories in a project.
8
+ #
9
+ # @example
10
+ # Gitlab.registry_repositories(5)
11
+ #
12
+ # @param [Integer, String] project The ID or name of a project.
13
+ # @return [Array<Gitlab::ObjectifiedHash>] Returns list of registry repositories in a project.
14
+ def registry_repositories(project)
15
+ get("/projects/#{url_encode project}/registry/repositories")
16
+ end
17
+
18
+ # Delete a repository in registry.
19
+ #
20
+ # @example
21
+ # Gitlab.delete_registry_repository(5, 2)
22
+ #
23
+ # @param [Integer, String] project The ID or name of a project.
24
+ # @param [Integer] id The ID of registry repository.
25
+ # @return [void] This API call returns an empty response body.
26
+ def delete_registry_repository(project, id)
27
+ delete("/projects/#{url_encode project}/registry/repositories/#{id}")
28
+ end
29
+
30
+ # Get a list of tags for given registry repository.
31
+ #
32
+ # @example
33
+ # Gitlab.registry_repository_tags(5, 2)
34
+ #
35
+ # @param [Integer, String] project The ID or name of a project.
36
+ # @param [Integer] repository_id The ID of registry repository.
37
+ # @return [Array<Gitlab::ObjectifiedHash>] Returns list of tags of a registry repository.
38
+ def registry_repository_tags(project, repository_id)
39
+ get("/projects/#{url_encode project}/registry/repositories/#{repository_id}/tags")
40
+ end
41
+
42
+ # Get details of a registry repository tag.
43
+ #
44
+ # @example
45
+ # Gitlab.registry_repository_tag(5, 2, 'v10.0.0')
46
+ #
47
+ # @param [Integer, String] project The ID or name of a project.
48
+ # @param [Integer] repository_id The ID of registry repository.
49
+ # @param [String] tag_name The name of tag.
50
+ # @return <Gitlab::ObjectifiedHash> Returns details about the registry repository tag
51
+ def registry_repository_tag(project, repository_id, tag_name)
52
+ get("/projects/#{url_encode project}/registry/repositories/#{repository_id}/tags/#{tag_name}")
53
+ end
54
+
55
+ # Delete a registry repository tag.
56
+ #
57
+ # @example
58
+ # Gitlab.delete_registry_repository_tag(5, 2, 'v10.0.0')
59
+ #
60
+ # @param [Integer, String] project The ID or name of a project.
61
+ # @param [Integer] repository_id The ID of registry repository.
62
+ # @param [String] tag_name The name of tag.
63
+ # @return [void] This API call returns an empty response body.
64
+ def delete_registry_repository_tag(project, repository_id, tag_name)
65
+ delete("/projects/#{url_encode project}/registry/repositories/#{repository_id}/tags/#{tag_name}")
66
+ end
67
+
68
+ # Delete repository tags in bulk based on given criteria.
69
+ #
70
+ # @example
71
+ # Gitlab.bulk_delete_registry_repository_tags(5, 2, name_regex: '.*')
72
+ # Gitlab.bulk_delete_registry_repository_tags(5, 2, name_regex: '[0-9a-z]{40}', keep_n: 5, older_than: '1d')
73
+ #
74
+ # @param [Integer, String] project The ID or name of a project.
75
+ # @param [Integer] repository_id The ID of registry repository.
76
+ # @param [Hash] options A customizable set of options.
77
+ # @option options [String] :name_regex(required) The regex of the name to delete. To delete all tags specify .*.
78
+ # @option options [Integer] :keep_n(optional) The amount of latest tags of given name to keep.
79
+ # @option options [String] :older_than(required) Tags to delete that are older than the given time, written in human readable form 1h, 1d, 1month.
80
+ # @return [void] This API call returns an empty response body.
81
+ def bulk_delete_registry_repository_tags(project, repository_id, options = {})
82
+ delete("/projects/#{url_encode project}/registry/repositories/#{repository_id}/tags", query: options)
83
+ end
84
+ end
85
+ end
@@ -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(optional) An array of User IDs that can approve MRs
41
- # @option options [Array] :approver_group_ids(optional) An array of Group IDs whose members can approve MRs
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}/approvals", body: options)
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,8 +76,8 @@ 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(optional) An array of User IDs that can approve MRs
80
- # @option options [Array] :approver_group_ids(optional) An array of Group IDs whose members can approve MRs
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
83
  put("/projects/#{url_encode project}/merge_requests/#{merge_request}/approvers", body: options)
@@ -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
- STDERR.puts 'Passing the note body as a Hash is deprecated. You should just pass the String.'
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 }
@@ -79,9 +79,11 @@ class Gitlab::Client
79
79
  # Gitlab.runner_jobs(1)
80
80
  #
81
81
  # @param [Integer] id The ID of a runner.
82
+ # @param [Hash] options A customizable set of options.
83
+ # @option options [String] :status Status of the job; one of: running, success, failed, canceled
82
84
  # @return [Array<Gitlab::ObjectifiedHash>]
83
- def runner_jobs(runner_id)
84
- get("/runners/#{url_encode runner_id}/jobs")
85
+ def runner_jobs(runner_id, options = {})
86
+ get("/runners/#{url_encode runner_id}/jobs", query: options)
85
87
  end
86
88
 
87
89
  # List all runners (specific and shared) available in the project. Shared runners are listed if at least one shared runner is defined and shared runners usage is enabled in the project's settings.
@@ -122,5 +124,50 @@ class Gitlab::Client
122
124
  def project_disable_runner(id, runner_id)
123
125
  delete("/projects/#{url_encode id}/runners/#{runner_id}")
124
126
  end
127
+
128
+ # Register a new Runner for the instance.
129
+ #
130
+ # @example
131
+ # Gitlab.register_runner('9142c16ea169eaaea3d752313a434a6e')
132
+ # Gitlab.register_runner('9142c16ea169eaaea3d752313a434a6e', description: 'Some Description', active: true, locked: false)
133
+ #
134
+ # @param [String] token Registration token.
135
+ # @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.
143
+ # @return <Gitlab::ObjectifiedHash> Response against runner registration
144
+ def register_runner(token, options = {})
145
+ body = { token: token }.merge(options)
146
+ post('/runners', body: body)
147
+ end
148
+
149
+ # Deletes a registed Runner.
150
+ #
151
+ # @example
152
+ # Gitlab.delete_registered_runner('9142c16ea169eaaea3d752313a434a6e')
153
+ #
154
+ # @param [String] token Runner authentication token.
155
+ # @return [nil] This API call returns an empty response body.
156
+ def delete_registered_runner(token)
157
+ body = { token: token }
158
+ delete('/runners', body: body)
159
+ end
160
+
161
+ # Validates authentication credentials for a registered Runner.
162
+ #
163
+ # @example
164
+ # Gitlab.verify_auth_registered_runner('9142c16ea169eaaea3d752313a434a6e')
165
+ #
166
+ # @param [String] token Runner authentication token.
167
+ # @return [nil] This API call returns an empty response body.
168
+ def verify_auth_registered_runner(token)
169
+ body = { token: token }
170
+ post('/runners/verify', body: body)
171
+ end
125
172
  end
126
173
  end
@@ -50,8 +50,8 @@ class Gitlab::Shell
50
50
  path = history_file_path
51
51
 
52
52
  File.foreach(path) { |line| yield(line) } if File.exist?(path)
53
- rescue StandardError => error
54
- warn "History file not loaded: #{error.message}"
53
+ rescue StandardError => e
54
+ warn "History file not loaded: #{e.message}"
55
55
  end
56
56
 
57
57
  def max_lines
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Gitlab
4
- VERSION = '4.10.0'
4
+ VERSION = '4.11.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.10.0
4
+ version: 4.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nihad Abbasov
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2019-02-22 00:00:00.000000000 Z
12
+ date: 2019-04-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty
@@ -148,6 +148,7 @@ files:
148
148
  - lib/gitlab/client/build_variables.rb
149
149
  - lib/gitlab/client/builds.rb
150
150
  - lib/gitlab/client/commits.rb
151
+ - lib/gitlab/client/container_registry.rb
151
152
  - lib/gitlab/client/deployments.rb
152
153
  - lib/gitlab/client/environments.rb
153
154
  - lib/gitlab/client/events.rb
@@ -160,6 +161,8 @@ files:
160
161
  - lib/gitlab/client/jobs.rb
161
162
  - lib/gitlab/client/keys.rb
162
163
  - lib/gitlab/client/labels.rb
164
+ - lib/gitlab/client/lint.rb
165
+ - lib/gitlab/client/markdown.rb
163
166
  - lib/gitlab/client/merge_request_approvals.rb
164
167
  - lib/gitlab/client/merge_requests.rb
165
168
  - lib/gitlab/client/milestones.rb