Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
f74f4238
Commit
f74f4238
authored
Jun 14, 2016
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Give 409 Conflict whenever the runner was already enabled
parent
1b03c580
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
4 deletions
+8
-4
CHANGELOG
CHANGELOG
+1
-0
app/models/ci/runner.rb
app/models/ci/runner.rb
+1
-1
lib/api/runners.rb
lib/api/runners.rb
+5
-2
spec/requests/api/runners_spec.rb
spec/requests/api/runners_spec.rb
+1
-1
No files found.
CHANGELOG
View file @
f74f4238
...
...
@@ -40,6 +40,7 @@ v 8.9.0 (unreleased)
- Added artifacts:when to .gitlab-ci.yml - this requires GitLab Runner 1.3
- Todos will display target state if issuable target is 'Closed' or 'Merged'
- Fix bug when sorting issues by milestone due date and filtering by two or more labels
- POST to API /projects/:id/runners/:runner_id would give 409 if the runner was already enabled for this project
- Add support for using Yubikeys (U2F) for two-factor authentication
- Link to blank group icon doesn't throw a 404 anymore
- Remove 'main language' feature
...
...
app/models/ci/runner.rb
View file @
f74f4238
...
...
@@ -56,7 +56,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
)
project
.
runner_projects
.
create
(
runner_id:
self
.
id
)
.
persisted?
end
def
display_name
...
...
lib/api/runners.rb
View file @
f74f4238
...
...
@@ -96,9 +96,12 @@ module API
runner
=
get_runner
(
params
[
:runner_id
])
authenticate_enable_runner!
(
runner
)
runner
.
assign_to
(
user_project
)
present
runner
,
with:
Entities
::
Runner
if
runner
.
assign_to
(
user_project
)
present
runner
,
with:
Entities
::
Runner
else
conflict!
(
"Runner was already enabled for this project"
)
end
end
# Disable project's runner
...
...
spec/requests/api/runners_spec.rb
View file @
f74f4238
...
...
@@ -375,7 +375,7 @@ describe API::Runners, api: true do
expect
do
post
api
(
"/projects/
#{
project
.
id
}
/runners"
,
user
),
runner_id:
specific_runner
.
id
end
.
to
change
{
project
.
runners
.
count
}.
by
(
0
)
expect
(
response
.
status
).
to
eq
(
201
)
expect
(
response
.
status
).
to
eq
(
409
)
end
it
'should not enable shared runner'
do
...
...
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