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
Boxiang Sun
gitlab-ce
Commits
6f19fc11
Commit
6f19fc11
authored
Aug 24, 2017
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add API support
parent
af112c55
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
4 deletions
+13
-4
doc/api/runners.md
doc/api/runners.md
+7
-2
lib/api/entities.rb
lib/api/entities.rb
+1
-0
lib/api/runners.rb
lib/api/runners.rb
+2
-1
spec/requests/api/runners_spec.rb
spec/requests/api/runners_spec.rb
+3
-1
No files found.
doc/api/runners.md
View file @
6f19fc11
...
@@ -138,7 +138,8 @@ Example response:
...
@@ -138,7 +138,8 @@ Example response:
"ruby"
,
"ruby"
,
"mysql"
"mysql"
],
],
"version"
:
null
"version"
:
null
,
"access_level"
:
0
}
}
```
```
...
@@ -156,6 +157,9 @@ PUT /runners/:id
...
@@ -156,6 +157,9 @@ PUT /runners/:id
|
`description`
| string | no | The description of a runner |
|
`description`
| string | no | The description of a runner |
|
`active`
| boolean | no | The state of a runner; can be set to
`true`
or
`false`
|
|
`active`
| boolean | no | The state of a runner; can be set to
`true`
or
`false`
|
|
`tag_list`
| array | no | The list of tags for a runner; put array of tags, that should be finally assigned to a runner |
|
`tag_list`
| array | no | The list of tags for a runner; put array of tags, that should be finally assigned to a runner |
|
`run_untagged`
| boolean | no | Flag indicating the runner can execute untagged jobs |
|
`locked`
| boolean | no | Flag indicating the runner is locked |
|
`access_level`
| integer | no | The access_level of the runner;
`unprotected`
: 0,
`protected`
: 1 |
```
```
curl --request PUT --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v4/runners/6" --form "description=test-1-20150125-test" --form "tag_list=ruby,mysql,tag1,tag2"
curl --request PUT --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v4/runners/6" --form "description=test-1-20150125-test" --form "tag_list=ruby,mysql,tag1,tag2"
...
@@ -190,7 +194,8 @@ Example response:
...
@@ -190,7 +194,8 @@ Example response:
"tag1"
,
"tag1"
,
"tag2"
"tag2"
],
],
"version"
:
null
"version"
:
null
,
"access_level"
:
0
}
}
```
```
...
...
lib/api/entities.rb
View file @
6f19fc11
...
@@ -775,6 +775,7 @@ module API
...
@@ -775,6 +775,7 @@ module API
expose
:tag_list
expose
:tag_list
expose
:run_untagged
expose
:run_untagged
expose
:locked
expose
:locked
expose
:access_level
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
].
admin?
||
!
runner
.
is_shared?
}
expose
:token
,
if:
lambda
{
|
runner
,
options
|
options
[
:current_user
].
admin?
||
!
runner
.
is_shared?
}
...
...
lib/api/runners.rb
View file @
6f19fc11
...
@@ -55,7 +55,8 @@ module API
...
@@ -55,7 +55,8 @@ module API
optional
:tag_list
,
type:
Array
[
String
],
desc:
'The list of tags for a runner'
optional
:tag_list
,
type:
Array
[
String
],
desc:
'The list of tags for a runner'
optional
:run_untagged
,
type:
Boolean
,
desc:
'Flag indicating the runner can execute untagged jobs'
optional
:run_untagged
,
type:
Boolean
,
desc:
'Flag indicating the runner can execute untagged jobs'
optional
:locked
,
type:
Boolean
,
desc:
'Flag indicating the runner is locked'
optional
:locked
,
type:
Boolean
,
desc:
'Flag indicating the runner is locked'
at_least_one_of
:description
,
:active
,
:tag_list
,
:run_untagged
,
:locked
optional
:access_level
,
type:
Integer
,
desc:
'The access_level of the runner'
at_least_one_of
:description
,
:active
,
:tag_list
,
:run_untagged
,
:locked
,
:access_level
end
end
put
':id'
do
put
':id'
do
runner
=
get_runner
(
params
.
delete
(
:id
))
runner
=
get_runner
(
params
.
delete
(
:id
))
...
...
spec/requests/api/runners_spec.rb
View file @
6f19fc11
...
@@ -191,7 +191,8 @@ describe API::Runners do
...
@@ -191,7 +191,8 @@ describe API::Runners do
active:
!
active
,
active:
!
active
,
tag_list:
[
'ruby2.1'
,
'pgsql'
,
'mysql'
],
tag_list:
[
'ruby2.1'
,
'pgsql'
,
'mysql'
],
run_untagged:
'false'
,
run_untagged:
'false'
,
locked:
'true'
)
locked:
'true'
,
access_level:
1
)
shared_runner
.
reload
shared_runner
.
reload
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_http_status
(
200
)
...
@@ -200,6 +201,7 @@ describe API::Runners do
...
@@ -200,6 +201,7 @@ describe API::Runners do
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
)
expect
(
shared_runner
.
run_untagged?
).
to
be
(
false
)
expect
(
shared_runner
.
locked?
).
to
be
(
true
)
expect
(
shared_runner
.
locked?
).
to
be
(
true
)
expect
(
shared_runner
.
protected_?
).
to
be_truthy
expect
(
shared_runner
.
ensure_runner_queue_value
)
expect
(
shared_runner
.
ensure_runner_queue_value
)
.
not_to
eq
(
runner_queue_value
)
.
not_to
eq
(
runner_queue_value
)
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