BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
9cf45b05
Commit
9cf45b05
authored
Jun 14, 2016
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Return the association and check it in controller instead:
Feedback:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/4641#note_12444891
parent
6c500034
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
4 deletions
+9
-4
runner_projects_controller.rb
app/controllers/admin/runner_projects_controller.rb
+3
-1
runner_projects_controller.rb
app/controllers/projects/runner_projects_controller.rb
+2
-1
runner.rb
app/models/ci/runner.rb
+1
-1
runners.rb
lib/api/runners.rb
+3
-1
No files found.
app/controllers/admin/runner_projects_controller.rb
View file @
9cf45b05
...
...
@@ -11,7 +11,9 @@ class Admin::RunnerProjectsController < Admin::ApplicationController
return
head
(
403
)
if
runner
.
is_shared?
||
runner
.
is_locked?
if
@runner
.
assign_to
(
@project
,
current_user
)
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'
...
...
app/controllers/projects/runner_projects_controller.rb
View file @
9cf45b05
...
...
@@ -10,8 +10,9 @@ class Projects::RunnerProjectsController < Projects::ApplicationController
return
head
(
403
)
unless
current_user
.
ci_authorized_runners
.
include?
(
@runner
)
path
=
runners_path
(
project
)
runner_project
=
@runner
.
assign_to
(
project
,
current_user
)
if
@runner
.
assign_to
(
project
,
current_user
)
if
runner_project
.
persisted?
redirect_to
path
else
redirect_to
path
,
alert:
'Failed adding runner to project'
...
...
app/models/ci/runner.rb
View file @
9cf45b05
...
...
@@ -63,7 +63,7 @@ module Ci
def
assign_to
(
project
,
current_user
=
nil
)
self
.
is_shared
=
false
if
shared?
self
.
save
project
.
runner_projects
.
create
(
runner_id:
self
.
id
)
.
persisted?
project
.
runner_projects
.
create
(
runner_id:
self
.
id
)
end
def
display_name
...
...
lib/api/runners.rb
View file @
9cf45b05
...
...
@@ -97,7 +97,9 @@ module API
runner
=
get_runner
(
params
[
:runner_id
])
authenticate_enable_runner!
(
runner
)
if
runner
.
assign_to
(
user_project
)
runner_project
=
runner
.
assign_to
(
user_project
)
if
runner_project
.
persisted?
present
runner
,
with:
Entities
::
Runner
else
conflict!
(
"Runner was already enabled for this project"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment