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
iv
gitlab-ce
Commits
4cc77c3b
Commit
4cc77c3b
authored
May 19, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor runner-related code refactorings
parent
c3c503d2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
21 deletions
+22
-21
app/controllers/admin/runners_controller.rb
app/controllers/admin/runners_controller.rb
+10
-9
app/views/projects/runners/_form.html.haml
app/views/projects/runners/_form.html.haml
+1
-1
spec/features/runners_spec.rb
spec/features/runners_spec.rb
+1
-1
spec/requests/ci/api/runners_spec.rb
spec/requests/ci/api/runners_spec.rb
+10
-10
No files found.
app/controllers/admin/runners_controller.rb
View file @
4cc77c3b
...
@@ -9,17 +9,18 @@ class Admin::RunnersController < Admin::ApplicationController
...
@@ -9,17 +9,18 @@ class Admin::RunnersController < Admin::ApplicationController
end
end
def
show
def
show
set
_builds_and_projects
assign
_builds_and_projects
end
end
def
update
def
update
unless
@runner
.
update_attributes
(
runner_params
)
if
@runner
.
update_attributes
(
runner_params
)
set_builds_and_projects
and
return
render
'show'
respond_to
do
|
format
|
end
format
.
js
format
.
html
{
redirect_to
admin_runner_path
(
@runner
)
}
respond_to
do
|
format
|
end
format
.
js
else
format
.
html
{
redirect_to
admin_runner_path
(
@runner
)
}
assign_builds_and_projects
render
'show'
end
end
end
end
...
@@ -55,7 +56,7 @@ class Admin::RunnersController < Admin::ApplicationController
...
@@ -55,7 +56,7 @@ class Admin::RunnersController < Admin::ApplicationController
params
.
require
(
:runner
).
permit
(
Ci
::
Runner
::
FORM_EDITABLE
)
params
.
require
(
:runner
).
permit
(
Ci
::
Runner
::
FORM_EDITABLE
)
end
end
def
set
_builds_and_projects
def
assign
_builds_and_projects
@builds
=
runner
.
builds
.
order
(
'id DESC'
).
first
(
30
)
@builds
=
runner
.
builds
.
order
(
'id DESC'
).
first
(
30
)
@projects
=
@projects
=
if
params
[
:search
].
present?
if
params
[
:search
].
present?
...
...
app/views/projects/runners/_form.html.haml
View file @
4cc77c3b
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
.col-sm-10
.col-sm-10
.checkbox
.checkbox
=
f
.
check_box
:run_untagged
=
f
.
check_box
:run_untagged
%span
.light
Indicates whether runner can pick jobs without tags
%span
.light
Indicates whether
this
runner can pick jobs without tags
.form-group
.form-group
=
label_tag
:token
,
class:
'control-label'
do
=
label_tag
:token
,
class:
'control-label'
do
Token
Token
...
...
spec/features/runners_spec.rb
View file @
4cc77c3b
...
@@ -129,7 +129,7 @@ describe "Runners" do
...
@@ -129,7 +129,7 @@ describe "Runners" do
context
'when runner has tags'
do
context
'when runner has tags'
do
before
{
runner
.
update_attribute
(
:tag_list
,
[
'tag'
])
}
before
{
runner
.
update_attribute
(
:tag_list
,
[
'tag'
])
}
scenario
'user want to prevent runner from running untagged job'
do
scenario
'user want
s
to prevent runner from running untagged job'
do
visit
runners_path
(
project
)
visit
runners_path
(
project
)
page
.
within
(
'.activated-specific-runners'
)
do
page
.
within
(
'.activated-specific-runners'
)
do
first
(
'small > a'
).
click
first
(
'small > a'
).
click
...
...
spec/requests/ci/api/runners_spec.rb
View file @
4cc77c3b
...
@@ -16,7 +16,7 @@ describe Ci::API::API do
...
@@ -16,7 +16,7 @@ describe Ci::API::API do
before
{
post
ci_api
(
"/runners/register"
),
token:
registration_token
}
before
{
post
ci_api
(
"/runners/register"
),
token:
registration_token
}
it
'creates runner with default values'
do
it
'creates runner with default values'
do
expect
(
response
.
status
).
to
eq
(
201
)
expect
(
response
).
to
have_http_status
201
expect
(
Ci
::
Runner
.
first
.
run_untagged
).
to
be
true
expect
(
Ci
::
Runner
.
first
.
run_untagged
).
to
be
true
end
end
end
end
...
@@ -28,7 +28,7 @@ describe Ci::API::API do
...
@@ -28,7 +28,7 @@ describe Ci::API::API do
end
end
it
'creates runner'
do
it
'creates runner'
do
expect
(
response
.
status
).
to
eq
(
201
)
expect
(
response
).
to
have_http_status
201
expect
(
Ci
::
Runner
.
first
.
description
).
to
eq
(
"server.hostname"
)
expect
(
Ci
::
Runner
.
first
.
description
).
to
eq
(
"server.hostname"
)
end
end
end
end
...
@@ -40,7 +40,7 @@ describe Ci::API::API do
...
@@ -40,7 +40,7 @@ describe Ci::API::API do
end
end
it
'creates runner'
do
it
'creates runner'
do
expect
(
response
.
status
).
to
eq
(
201
)
expect
(
response
).
to
have_http_status
201
expect
(
Ci
::
Runner
.
first
.
tag_list
.
sort
).
to
eq
([
"tag1"
,
"tag2"
])
expect
(
Ci
::
Runner
.
first
.
tag_list
.
sort
).
to
eq
([
"tag1"
,
"tag2"
])
end
end
end
end
...
@@ -52,7 +52,7 @@ describe Ci::API::API do
...
@@ -52,7 +52,7 @@ describe Ci::API::API do
run_untagged:
false
,
run_untagged:
false
,
tag_list:
[
'tag'
]
tag_list:
[
'tag'
]
expect
(
response
.
status
).
to
eq
(
201
)
expect
(
response
).
to
have_http_status
201
expect
(
Ci
::
Runner
.
first
.
run_untagged
).
to
be
false
expect
(
Ci
::
Runner
.
first
.
run_untagged
).
to
be
false
end
end
end
end
...
@@ -62,7 +62,7 @@ describe Ci::API::API do
...
@@ -62,7 +62,7 @@ describe Ci::API::API do
post
ci_api
(
"/runners/register"
),
token:
registration_token
,
post
ci_api
(
"/runners/register"
),
token:
registration_token
,
run_untagged:
false
run_untagged:
false
expect
(
response
.
status
).
to
eq
(
404
)
expect
(
response
).
to
have_http_status
404
end
end
end
end
end
end
...
@@ -72,7 +72,7 @@ describe Ci::API::API do
...
@@ -72,7 +72,7 @@ describe Ci::API::API do
before
{
post
ci_api
(
"/runners/register"
),
token:
project
.
runners_token
}
before
{
post
ci_api
(
"/runners/register"
),
token:
project
.
runners_token
}
it
'creates runner'
do
it
'creates runner'
do
expect
(
response
.
status
).
to
eq
(
201
)
expect
(
response
).
to
have_http_status
201
expect
(
project
.
runners
.
size
).
to
eq
(
1
)
expect
(
project
.
runners
.
size
).
to
eq
(
1
)
end
end
end
end
...
@@ -81,7 +81,7 @@ describe Ci::API::API do
...
@@ -81,7 +81,7 @@ describe Ci::API::API do
it
'returns 403 error'
do
it
'returns 403 error'
do
post
ci_api
(
"/runners/register"
),
token:
'invalid'
post
ci_api
(
"/runners/register"
),
token:
'invalid'
expect
(
response
.
status
).
to
eq
(
403
)
expect
(
response
).
to
have_http_status
403
end
end
end
end
...
@@ -89,7 +89,7 @@ describe Ci::API::API do
...
@@ -89,7 +89,7 @@ describe Ci::API::API do
it
'returns 400 error'
do
it
'returns 400 error'
do
post
ci_api
(
"/runners/register"
)
post
ci_api
(
"/runners/register"
)
expect
(
response
.
status
).
to
eq
(
400
)
expect
(
response
).
to
have_http_status
400
end
end
end
end
...
@@ -101,7 +101,7 @@ describe Ci::API::API do
...
@@ -101,7 +101,7 @@ describe Ci::API::API do
it
do
it
do
post
ci_api
(
"/runners/register"
),
token:
registration_token
,
info:
{
param
=>
value
}
post
ci_api
(
"/runners/register"
),
token:
registration_token
,
info:
{
param
=>
value
}
expect
(
response
.
status
).
to
eq
(
201
)
expect
(
response
).
to
have_http_status
201
is_expected
.
to
eq
(
value
)
is_expected
.
to
eq
(
value
)
end
end
end
end
...
@@ -112,7 +112,7 @@ describe Ci::API::API do
...
@@ -112,7 +112,7 @@ describe Ci::API::API do
let!
(
:runner
)
{
FactoryGirl
.
create
(
:ci_runner
)
}
let!
(
:runner
)
{
FactoryGirl
.
create
(
:ci_runner
)
}
before
{
delete
ci_api
(
"/runners/delete"
),
token:
runner
.
token
}
before
{
delete
ci_api
(
"/runners/delete"
),
token:
runner
.
token
}
it
{
expect
(
response
.
status
).
to
eq
(
200
)
}
it
{
expect
(
response
).
to
have_http_status
200
}
it
{
expect
(
Ci
::
Runner
.
count
).
to
eq
(
0
)
}
it
{
expect
(
Ci
::
Runner
.
count
).
to
eq
(
0
)
}
end
end
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