lib/gitlab/client/runners.rb in gitlab-4.10.0 vs lib/gitlab/client/runners.rb in gitlab-4.11.0
- old
+ new
@@ -77,13 +77,15 @@
#
# @example
# Gitlab.runner_jobs(1)
#
# @param [Integer] id The ID of a runner.
+ # @param [Hash] options A customizable set of options.
+ # @option options [String] :status Status of the job; one of: running, success, failed, canceled
# @return [Array<Gitlab::ObjectifiedHash>]
- def runner_jobs(runner_id)
- get("/runners/#{url_encode runner_id}/jobs")
+ def runner_jobs(runner_id, options = {})
+ get("/runners/#{url_encode runner_id}/jobs", query: options)
end
# 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.
# @see https://docs.gitlab.com/ce/api/runners.html#list-projects-runners
#
@@ -119,8 +121,53 @@
# @param [Integer, String] id The ID or name of a project.
# @param [Integer, String] runner_id The ID of a runner.
# @return <Gitlab::ObjectifiedHash>
def project_disable_runner(id, runner_id)
delete("/projects/#{url_encode id}/runners/#{runner_id}")
+ end
+
+ # Register a new Runner for the instance.
+ #
+ # @example
+ # Gitlab.register_runner('9142c16ea169eaaea3d752313a434a6e')
+ # Gitlab.register_runner('9142c16ea169eaaea3d752313a434a6e', description: 'Some Description', active: true, locked: false)
+ #
+ # @param [String] token Registration token.
+ # @param [Hash] options A customizable set of options.
+ # @option options [String] :description Runner description.
+ # @option options [Hash] :info Runner metadata.
+ # @option options [Boolean] :active Whether the Runner is active.
+ # @option options [Boolean] :locked Whether the Runner should be locked for current project.
+ # @option options [Boolean] :run_untagged Whether the Runner should handle untagged jobs.
+ # @option options [Array<String>] :tag_list List of Runner tags.
+ # @option options [Integer] :maximum_timeout Maximum timeout set when this Runner will handle the job.
+ # @return <Gitlab::ObjectifiedHash> Response against runner registration
+ def register_runner(token, options = {})
+ body = { token: token }.merge(options)
+ post('/runners', body: body)
+ end
+
+ # Deletes a registed Runner.
+ #
+ # @example
+ # Gitlab.delete_registered_runner('9142c16ea169eaaea3d752313a434a6e')
+ #
+ # @param [String] token Runner authentication token.
+ # @return [nil] This API call returns an empty response body.
+ def delete_registered_runner(token)
+ body = { token: token }
+ delete('/runners', body: body)
+ end
+
+ # Validates authentication credentials for a registered Runner.
+ #
+ # @example
+ # Gitlab.verify_auth_registered_runner('9142c16ea169eaaea3d752313a434a6e')
+ #
+ # @param [String] token Runner authentication token.
+ # @return [nil] This API call returns an empty response body.
+ def verify_auth_registered_runner(token)
+ body = { token: token }
+ post('/runners/verify', body: body)
end
end
end