summaryrefslogtreecommitdiff
path: root/lib/api/runners.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/api/runners.rb')
-rw-r--r--lib/api/runners.rb88
1 files changed, 44 insertions, 44 deletions
diff --git a/lib/api/runners.rb b/lib/api/runners.rb
index f3fea463e7f..1e99fbabcc8 100644
--- a/lib/api/runners.rb
+++ b/lib/api/runners.rb
@@ -7,17 +7,17 @@ module API
before { authenticate! }
resource :runners do
- desc 'Get runners available for user' do
+ desc "Get runners available for user" do
success Entities::Runner
end
params do
optional :scope, type: String, values: Ci::Runner::AVAILABLE_STATUSES,
- desc: 'The scope of specific runners to show'
+ desc: "The scope of specific runners to show"
optional :type, type: String, values: Ci::Runner::AVAILABLE_TYPES,
- desc: 'The type of the runners to show'
+ desc: "The type of the runners to show"
optional :status, type: String, values: Ci::Runner::AVAILABLE_STATUSES,
- desc: 'The status of the runners to show'
- optional :tag_list, type: Array[String], desc: 'The tags of the runners to show'
+ desc: "The status of the runners to show"
+ optional :tag_list, type: Array[String], desc: "The tags of the runners to show"
use :pagination
end
get do
@@ -30,20 +30,20 @@ module API
present paginate(runners), with: Entities::Runner
end
- desc 'Get all runners - shared and specific' do
+ desc "Get all runners - shared and specific" do
success Entities::Runner
end
params do
optional :scope, type: String, values: Ci::Runner::AVAILABLE_SCOPES,
- desc: 'The scope of specific runners to show'
+ desc: "The scope of specific runners to show"
optional :type, type: String, values: Ci::Runner::AVAILABLE_TYPES,
- desc: 'The type of the runners to show'
+ desc: "The type of the runners to show"
optional :status, type: String, values: Ci::Runner::AVAILABLE_STATUSES,
- desc: 'The status of the runners to show'
- optional :tag_list, type: Array[String], desc: 'The tags of the runners to show'
+ desc: "The status of the runners to show"
+ optional :tag_list, type: Array[String], desc: "The tags of the runners to show"
use :pagination
end
- get 'all' do
+ get "all" do
authenticated_as_admin!
runners = Ci::Runner.all
@@ -59,9 +59,9 @@ module API
success Entities::RunnerDetails
end
params do
- requires :id, type: Integer, desc: 'The ID of the runner'
+ requires :id, type: Integer, desc: "The ID of the runner"
end
- get ':id' do
+ get ":id" do
runner = get_runner(params[:id])
authenticate_show_runner!(runner)
@@ -72,18 +72,18 @@ module API
success Entities::RunnerDetails
end
params do
- requires :id, type: Integer, desc: 'The ID of the runner'
- optional :description, type: String, desc: 'The description of the runner'
- optional :active, type: Boolean, desc: 'The state of a runner'
- optional :tag_list, type: Array[String], desc: 'The list of tags for a runner'
- optional :run_untagged, type: Boolean, desc: 'Flag indicating the runner can execute untagged jobs'
- optional :locked, type: Boolean, desc: 'Flag indicating the runner is locked'
+ requires :id, type: Integer, desc: "The ID of the runner"
+ optional :description, type: String, desc: "The description of the runner"
+ optional :active, type: Boolean, desc: "The state of a runner"
+ optional :tag_list, type: Array[String], desc: "The list of tags for a runner"
+ optional :run_untagged, type: Boolean, desc: "Flag indicating the runner can execute untagged jobs"
+ optional :locked, type: Boolean, desc: "Flag indicating the runner is locked"
optional :access_level, type: String, values: Ci::Runner.access_levels.keys,
- desc: 'The access_level of the runner'
- optional :maximum_timeout, type: Integer, desc: 'Maximum timeout set when this Runner will handle the job'
+ desc: "The access_level of the runner"
+ optional :maximum_timeout, type: Integer, desc: "Maximum timeout set when this Runner will handle the job"
at_least_one_of :description, :active, :tag_list, :run_untagged, :locked, :access_level, :maximum_timeout
end
- put ':id' do
+ put ":id" do
runner = get_runner(params.delete(:id))
authenticate_update_runner!(runner)
update_service = Ci::UpdateRunnerService.new(runner)
@@ -95,13 +95,13 @@ module API
end
end
- desc 'Remove a runner' do
+ desc "Remove a runner" do
success Entities::Runner
end
params do
- requires :id, type: Integer, desc: 'The ID of the runner'
+ requires :id, type: Integer, desc: "The ID of the runner"
end
- delete ':id' do
+ delete ":id" do
runner = get_runner(params[:id])
authenticate_delete_runner!(runner)
@@ -109,15 +109,15 @@ module API
destroy_conditionally!(runner)
end
- desc 'List jobs running on a runner' do
+ desc "List jobs running on a runner" do
success Entities::JobBasicWithProject
end
params do
- requires :id, type: Integer, desc: 'The ID of the runner'
- optional :status, type: String, desc: 'Status of the job', values: Ci::Build::AVAILABLE_STATUSES
+ requires :id, type: Integer, desc: "The ID of the runner"
+ optional :status, type: String, desc: "Status of the job", values: Ci::Build::AVAILABLE_STATUSES
use :pagination
end
- get ':id/jobs' do
+ get ":id/jobs" do
runner = get_runner(params[:id])
authenticate_list_runners_jobs!(runner)
@@ -128,25 +128,25 @@ module API
end
params do
- requires :id, type: String, desc: 'The ID of a project'
+ requires :id, type: String, desc: "The ID of a project"
end
resource :projects, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do
before { authorize_admin_project }
- desc 'Get runners available for project' do
+ desc "Get runners available for project" do
success Entities::Runner
end
params do
optional :scope, type: String, values: Ci::Runner::AVAILABLE_SCOPES,
- desc: 'The scope of specific runners to show'
+ desc: "The scope of specific runners to show"
optional :type, type: String, values: Ci::Runner::AVAILABLE_TYPES,
- desc: 'The type of the runners to show'
+ desc: "The type of the runners to show"
optional :status, type: String, values: Ci::Runner::AVAILABLE_STATUSES,
- desc: 'The status of the runners to show'
- optional :tag_list, type: Array[String], desc: 'The tags of the runners to show'
+ desc: "The status of the runners to show"
+ optional :tag_list, type: Array[String], desc: "The tags of the runners to show"
use :pagination
end
- get ':id/runners' do
+ get ":id/runners" do
runners = Ci::Runner.owned_or_instance_wide(user_project.id)
runners = filter_runners(runners, params[:scope])
runners = filter_runners(runners, params[:type], allowed_scopes: Ci::Runner::AVAILABLE_TYPES)
@@ -156,13 +156,13 @@ module API
present paginate(runners), with: Entities::Runner
end
- desc 'Enable a runner for a project' do
+ desc "Enable a runner for a project" do
success Entities::Runner
end
params do
- requires :runner_id, type: Integer, desc: 'The ID of the runner'
+ requires :runner_id, type: Integer, desc: "The ID of the runner"
end
- post ':id/runners' do
+ post ":id/runners" do
runner = get_runner(params[:runner_id])
authenticate_enable_runner!(runner)
@@ -177,12 +177,12 @@ module API
success Entities::Runner
end
params do
- requires :runner_id, type: Integer, desc: 'The ID of the runner'
+ requires :runner_id, type: Integer, desc: "The ID of the runner"
end
# rubocop: disable CodeReuse/ActiveRecord
- delete ':id/runners/:runner_id' do
+ delete ":id/runners/:runner_id" do
runner_project = user_project.runner_projects.find_by(runner_id: params[:runner_id])
- not_found!('Runner') unless runner_project
+ not_found!("Runner") unless runner_project
runner = runner_project.runner
forbidden!("Only one project associated with the runner. Please remove the runner instead") if runner.projects.count == 1
@@ -197,7 +197,7 @@ module API
return runners unless scope.present?
unless allowed_scopes.include?(scope)
- render_api_error!('Scope contains invalid value', 400)
+ render_api_error!("Scope contains invalid value", 400)
end
# Support deprecated scopes
@@ -210,7 +210,7 @@ module API
def get_runner(id)
runner = Ci::Runner.find(id)
- not_found!('Runner') unless runner
+ not_found!("Runner") unless runner
runner
end