mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-10 21:26:07 +10:00
Admin should be able to turn shared runners into specific ones:
## What does this MR do?
Make sure admins could turn shared runners into specific runners.
## Are there points in the code the reviewer needs to double check?
Is this the desired behaviour?
## Why was this MR needed?
Closes #19039
Closes #19272

See merge request !4961
(cherry picked from commit b569f842b3)
33 lines
770 B
Ruby
33 lines
770 B
Ruby
class Admin::RunnerProjectsController < Admin::ApplicationController
|
|
before_action :project, only: [:create]
|
|
|
|
def create
|
|
@runner = Ci::Runner.find(params[:runner_project][:runner_id])
|
|
|
|
runner_project = @runner.assign_to(@project, current_user)
|
|
|
|
if runner_project.persisted?
|
|
redirect_to admin_runner_path(@runner)
|
|
else
|
|
redirect_to admin_runner_path(@runner), alert: 'Failed adding runner to project'
|
|
end
|
|
end
|
|
|
|
def destroy
|
|
rp = Ci::RunnerProject.find(params[:id])
|
|
runner = rp.runner
|
|
rp.destroy
|
|
|
|
redirect_to admin_runner_path(runner)
|
|
end
|
|
|
|
private
|
|
|
|
def project
|
|
@project = Project.find_with_namespace(
|
|
[params[:namespace_id], '/', params[:project_id]].join('')
|
|
)
|
|
@project || render_404
|
|
end
|
|
end
|