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
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
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
4 deletions
+8
-4
CHANGELOG
CHANGELOG
+1
-0
runner.rb
app/models/ci/runner.rb
+1
-1
runners.rb
lib/api/runners.rb
+5
-2
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