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
0
Merge Requests
0
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
Jérome Perrin
gitlab-ce
Commits
2e1b2233
Commit
2e1b2233
authored
Mar 13, 2017
by
Tomasz Maczukin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix regression in runners registration v1 api
parent
cc64eda9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
2 deletions
+8
-2
lib/ci/api/runners.rb
lib/ci/api/runners.rb
+2
-2
spec/requests/api/runner_spec.rb
spec/requests/api/runner_spec.rb
+3
-0
spec/requests/ci/api/runners_spec.rb
spec/requests/ci/api/runners_spec.rb
+3
-0
No files found.
lib/ci/api/runners.rb
View file @
2e1b2233
...
...
@@ -24,13 +24,13 @@ module Ci
optional
:locked
,
type:
Boolean
,
desc:
'Lock this runner for this specific project'
end
post
"register"
do
runner_params
=
declared
(
params
,
include_missing:
false
)
runner_params
=
declared
(
params
,
include_missing:
false
)
.
except
(
:token
)
runner
=
if
runner_registration_token_valid?
# Create shared runner. Requires admin access
Ci
::
Runner
.
create
(
runner_params
.
merge
(
is_shared:
true
))
elsif
project
=
Project
.
find_by
(
runners_token:
runner_
params
[
:token
])
elsif
project
=
Project
.
find_by
(
runners_token:
params
[
:token
])
# Create a specific runner for project.
project
.
runners
.
create
(
runner_params
)
end
...
...
spec/requests/api/runner_spec.rb
View file @
2e1b2233
...
...
@@ -39,6 +39,7 @@ describe API::Runner do
expect
(
json_response
[
'id'
]).
to
eq
(
runner
.
id
)
expect
(
json_response
[
'token'
]).
to
eq
(
runner
.
token
)
expect
(
runner
.
run_untagged
).
to
be
true
expect
(
runner
.
token
).
not_to
eq
(
registration_token
)
end
context
'when project token is used'
do
...
...
@@ -49,6 +50,8 @@ describe API::Runner do
expect
(
response
).
to
have_http_status
201
expect
(
project
.
runners
.
size
).
to
eq
(
1
)
expect
(
Ci
::
Runner
.
first
.
token
).
not_to
eq
(
registration_token
)
expect
(
Ci
::
Runner
.
first
.
token
).
not_to
eq
(
project
.
runners_token
)
end
end
end
...
...
spec/requests/ci/api/runners_spec.rb
View file @
2e1b2233
...
...
@@ -18,6 +18,7 @@ describe Ci::API::Runners do
it
'creates runner with default values'
do
expect
(
response
).
to
have_http_status
201
expect
(
Ci
::
Runner
.
first
.
run_untagged
).
to
be
true
expect
(
Ci
::
Runner
.
first
.
token
).
not_to
eq
(
registration_token
)
end
end
...
...
@@ -74,6 +75,8 @@ describe Ci::API::Runners do
it
'creates runner'
do
expect
(
response
).
to
have_http_status
201
expect
(
project
.
runners
.
size
).
to
eq
(
1
)
expect
(
Ci
::
Runner
.
first
.
token
).
not_to
eq
(
registration_token
)
expect
(
Ci
::
Runner
.
first
.
token
).
not_to
eq
(
project
.
runners_token
)
end
end
...
...
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