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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
6108ae3a
Commit
6108ae3a
authored
Apr 19, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
231f7df7
604cfb17
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
1 deletion
+35
-1
changelogs/unreleased/add-runner-access-level-registration.yml
...elogs/unreleased/add-runner-access-level-registration.yml
+5
-0
doc/api/runners.md
doc/api/runners.md
+1
-0
lib/api/runner.rb
lib/api/runner.rb
+3
-1
spec/requests/api/runner_spec.rb
spec/requests/api/runner_spec.rb
+26
-0
No files found.
changelogs/unreleased/add-runner-access-level-registration.yml
0 → 100644
View file @
6108ae3a
---
title
:
Add option to set access_level of runners upon registration
merge_request
:
27490
author
:
Zelin L
type
:
added
doc/api/runners.md
View file @
6108ae3a
...
...
@@ -486,6 +486,7 @@ POST /runners
|
`locked`
| boolean| no | Whether the Runner should be locked for current project |
|
`run_untagged`
| boolean | no | Whether the Runner should handle untagged jobs |
|
`tag_list`
| Array[String] | no | List of Runner's tags |
|
`access_level`
| string | no | The access_level of the runner;
`not_protected`
or
`ref_protected`
|
|
`maximum_timeout`
| integer | no | Maximum timeout set when this Runner will handle the job |
```
...
...
lib/api/runner.rb
View file @
6108ae3a
...
...
@@ -15,12 +15,14 @@ module API
optional
:info
,
type:
Hash
,
desc:
%q(Runner's metadata)
optional
:active
,
type:
Boolean
,
desc:
'Should Runner be active'
optional
:locked
,
type:
Boolean
,
desc:
'Should Runner be locked for current project'
optional
:access_level
,
type:
String
,
values:
Ci
::
Runner
.
access_levels
.
keys
,
desc:
'The access_level of the runner'
optional
:run_untagged
,
type:
Boolean
,
desc:
'Should Runner handle untagged jobs'
optional
:tag_list
,
type:
Array
[
String
],
desc:
%q(List of Runner's tags)
optional
:maximum_timeout
,
type:
Integer
,
desc:
'Maximum timeout set when this Runner will handle the job'
end
post
'/'
do
attributes
=
attributes_for_keys
([
:description
,
:active
,
:locked
,
:run_untagged
,
:tag_list
,
:maximum_timeout
])
attributes
=
attributes_for_keys
([
:description
,
:active
,
:locked
,
:run_untagged
,
:tag_list
,
:
access_level
,
:
maximum_timeout
])
.
merge
(
get_runner_details_from_request
)
attributes
=
...
...
spec/requests/api/runner_spec.rb
View file @
6108ae3a
...
...
@@ -168,6 +168,32 @@ describe API::Runner, :clean_gitlab_redis_shared_state do
end
end
context
'when access_level is provided for Runner'
do
context
'when access_level is set to ref_protected'
do
it
'creates runner'
do
post
api
(
'/runners'
),
params:
{
token:
registration_token
,
access_level:
'ref_protected'
}
expect
(
response
).
to
have_gitlab_http_status
201
expect
(
Ci
::
Runner
.
first
.
ref_protected?
).
to
be
true
end
end
context
'when access_level is set to not_protected'
do
it
'creates runner'
do
post
api
(
'/runners'
),
params:
{
token:
registration_token
,
access_level:
'not_protected'
}
expect
(
response
).
to
have_gitlab_http_status
201
expect
(
Ci
::
Runner
.
first
.
ref_protected?
).
to
be
false
end
end
end
context
'when maximum job timeout is specified'
do
it
'creates runner'
do
post
api
(
'/runners'
),
params:
{
...
...
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