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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
da8b72d4
Commit
da8b72d4
authored
May 06, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extend runner options that are configurable via API
parent
7b607cf4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
5 deletions
+13
-5
lib/api/entities.rb
lib/api/entities.rb
+1
-0
lib/api/runners.rb
lib/api/runners.rb
+1
-1
spec/requests/api/runners_spec.rb
spec/requests/api/runners_spec.rb
+11
-4
No files found.
lib/api/entities.rb
View file @
da8b72d4
...
@@ -408,6 +408,7 @@ module API
...
@@ -408,6 +408,7 @@ module API
class
RunnerDetails
<
Runner
class
RunnerDetails
<
Runner
expose
:tag_list
expose
:tag_list
expose
:run_untagged
expose
:version
,
:revision
,
:platform
,
:architecture
expose
:version
,
:revision
,
:platform
,
:architecture
expose
:contacted_at
expose
:contacted_at
expose
:token
,
if:
lambda
{
|
runner
,
options
|
options
[
:current_user
].
is_admin?
||
!
runner
.
is_shared?
}
expose
:token
,
if:
lambda
{
|
runner
,
options
|
options
[
:current_user
].
is_admin?
||
!
runner
.
is_shared?
}
...
...
lib/api/runners.rb
View file @
da8b72d4
...
@@ -49,7 +49,7 @@ module API
...
@@ -49,7 +49,7 @@ module API
runner
=
get_runner
(
params
[
:id
])
runner
=
get_runner
(
params
[
:id
])
authenticate_update_runner!
(
runner
)
authenticate_update_runner!
(
runner
)
attrs
=
attributes_for_keys
[
:description
,
:active
,
:tag_list
]
attrs
=
attributes_for_keys
[
:description
,
:active
,
:tag_list
,
:run_untagged
]
if
runner
.
update
(
attrs
)
if
runner
.
update
(
attrs
)
present
runner
,
with:
Entities
::
RunnerDetails
,
current_user:
current_user
present
runner
,
with:
Entities
::
RunnerDetails
,
current_user:
current_user
else
else
...
...
spec/requests/api/runners_spec.rb
View file @
da8b72d4
...
@@ -184,21 +184,24 @@ describe API::Runners, api: true do
...
@@ -184,21 +184,24 @@ describe API::Runners, api: true do
description
=
shared_runner
.
description
description
=
shared_runner
.
description
active
=
shared_runner
.
active
active
=
shared_runner
.
active
put
api
(
"/runners/
#{
shared_runner
.
id
}
"
,
admin
),
description:
"
#{
description
}
_updated"
,
active:
!
active
,
update_runner
(
shared_runner
.
id
,
admin
,
description:
"
#{
description
}
_updated"
,
tag_list:
[
'ruby2.1'
,
'pgsql'
,
'mysql'
]
active:
!
active
,
tag_list:
[
'ruby2.1'
,
'pgsql'
,
'mysql'
],
run_untagged:
'false'
)
shared_runner
.
reload
shared_runner
.
reload
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
shared_runner
.
description
).
to
eq
(
"
#{
description
}
_updated"
)
expect
(
shared_runner
.
description
).
to
eq
(
"
#{
description
}
_updated"
)
expect
(
shared_runner
.
active
).
to
eq
(
!
active
)
expect
(
shared_runner
.
active
).
to
eq
(
!
active
)
expect
(
shared_runner
.
tag_list
).
to
include
(
'ruby2.1'
,
'pgsql'
,
'mysql'
)
expect
(
shared_runner
.
tag_list
).
to
include
(
'ruby2.1'
,
'pgsql'
,
'mysql'
)
expect
(
shared_runner
.
run_untagged?
).
to
be
false
end
end
end
end
context
'when runner is not shared'
do
context
'when runner is not shared'
do
it
'should update runner'
do
it
'should update runner'
do
description
=
specific_runner
.
description
description
=
specific_runner
.
description
put
api
(
"/runners/
#{
specific_runner
.
id
}
"
,
admin
),
description:
'test'
update_runner
(
specific_runner
.
id
,
admin
,
description:
'test'
)
specific_runner
.
reload
specific_runner
.
reload
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
response
.
status
).
to
eq
(
200
)
...
@@ -208,10 +211,14 @@ describe API::Runners, api: true do
...
@@ -208,10 +211,14 @@ describe API::Runners, api: true do
end
end
it
'should return 404 if runner does not exists'
do
it
'should return 404 if runner does not exists'
do
put
api
(
'/runners/9999'
,
admin
),
description:
'test'
update_runner
(
9999
,
admin
,
description:
'test'
)
expect
(
response
.
status
).
to
eq
(
404
)
expect
(
response
.
status
).
to
eq
(
404
)
end
end
def
update_runner
(
id
,
user
,
args
)
put
api
(
"/runners/
#{
id
}
"
,
user
),
args
end
end
end
context
'authorized user'
do
context
'authorized user'
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