Commit 1ee83819 authored by Lin Jen-Shin's avatar Lin Jen-Shin

No need to tick the queue when creating the runner

Feedback:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/8664/diffs#note_22190504
parent 985c68a1
......@@ -28,27 +28,23 @@ module Ci
post "register" do
required_attributes! [:token]
project = nil
attributes = attributes_for_keys(
[:description, :tag_list, :run_untagged, :locked]
)
runner =
if runner_registration_token_valid?
# Create shared runner. Requires admin access
Ci::Runner.new(is_shared: true)
Ci::Runner.create(attributes.merge(is_shared: true))
elsif project = Project.find_by(runners_token: params[:token])
Ci::Runner.new
# Create a specific runner for project.
project.runners.create(attributes)
end
return forbidden! unless runner
attributes = attributes_for_keys(
[:description, :tag_list, :run_untagged, :locked]
).merge(get_runner_version_from_params || {})
Ci::UpdateRunnerService.new(runner).update(attributes)
# Assign the specific runner for the project
project.runners << runner if project
if runner.id
runner.update(get_runner_version_from_params)
present runner, with: Entities::Runner
else
not_found!
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment