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
7b82f4ba
Commit
7b82f4ba
authored
Feb 19, 2018
by
Tomasz Maczukin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for job_upper_timeout in API
parent
fb0dec4e
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
23 additions
and
4 deletions
+23
-4
doc/api/runners.md
doc/api/runners.md
+5
-2
lib/api/entities.rb
lib/api/entities.rb
+1
-0
lib/api/runner.rb
lib/api/runner.rb
+2
-1
lib/api/runners.rb
lib/api/runners.rb
+1
-0
spec/requests/api/runner_spec.rb
spec/requests/api/runner_spec.rb
+10
-0
spec/requests/api/runners_spec.rb
spec/requests/api/runners_spec.rb
+4
-1
No files found.
doc/api/runners.md
View file @
7b82f4ba
...
@@ -153,7 +153,8 @@ Example response:
...
@@ -153,7 +153,8 @@ Example response:
"mysql"
"mysql"
],
],
"version"
:
null
,
"version"
:
null
,
"access_level"
:
"ref_protected"
"access_level"
:
"ref_protected"
,
"job_upper_timeout"
:
3600
}
}
```
```
...
@@ -174,6 +175,7 @@ PUT /runners/:id
...
@@ -174,6 +175,7 @@ PUT /runners/:id
|
`run_untagged`
| boolean | no | Flag indicating the runner can execute untagged jobs |
|
`run_untagged`
| boolean | no | Flag indicating the runner can execute untagged jobs |
|
`locked`
| boolean | no | Flag indicating the runner is locked |
|
`locked`
| boolean | no | Flag indicating the runner is locked |
|
`access_level`
| string | no | The access_level of the runner;
`not_protected`
or
`ref_protected`
|
|
`access_level`
| string | no | The access_level of the runner;
`not_protected`
or
`ref_protected`
|
|
`job_upper_timeout`
| integer | no | Upper timeout set when this Runner will handle the job |
```
```
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"
...
@@ -211,7 +213,8 @@ Example response:
...
@@ -211,7 +213,8 @@ Example response:
"tag2"
"tag2"
],
],
"version"
:
null
,
"version"
:
null
,
"access_level"
:
"ref_protected"
"access_level"
:
"ref_protected"
,
"job_upper_timeout"
:
null
}
}
```
```
...
...
lib/api/entities.rb
View file @
7b82f4ba
...
@@ -951,6 +951,7 @@ module API
...
@@ -951,6 +951,7 @@ module API
expose
:tag_list
expose
:tag_list
expose
:run_untagged
expose
:run_untagged
expose
:locked
expose
:locked
expose
:job_upper_timeout
expose
:access_level
expose
:access_level
expose
:version
,
:revision
,
:platform
,
:architecture
expose
:version
,
:revision
,
:platform
,
:architecture
expose
:contacted_at
expose
:contacted_at
...
...
lib/api/runner.rb
View file @
7b82f4ba
...
@@ -14,9 +14,10 @@ module API
...
@@ -14,9 +14,10 @@ module API
optional
:locked
,
type:
Boolean
,
desc:
'Should Runner be locked for current project'
optional
:locked
,
type:
Boolean
,
desc:
'Should Runner be locked for current project'
optional
:run_untagged
,
type:
Boolean
,
desc:
'Should Runner handle untagged jobs'
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
:tag_list
,
type:
Array
[
String
],
desc:
%q(List of Runner's tags)
optional
:job_upper_timeout
,
type:
Integer
,
desc:
'Upper timeout set when this Runner will handle the job'
end
end
post
'/'
do
post
'/'
do
attributes
=
attributes_for_keys
([
:description
,
:locked
,
:run_untagged
,
:tag_list
])
attributes
=
attributes_for_keys
([
:description
,
:locked
,
:run_untagged
,
:tag_list
,
:job_upper_timeout
])
.
merge
(
get_runner_details_from_request
)
.
merge
(
get_runner_details_from_request
)
runner
=
runner
=
...
...
lib/api/runners.rb
View file @
7b82f4ba
...
@@ -57,6 +57,7 @@ module API
...
@@ -57,6 +57,7 @@ module API
optional
:locked
,
type:
Boolean
,
desc:
'Flag indicating the runner is locked'
optional
:locked
,
type:
Boolean
,
desc:
'Flag indicating the runner is locked'
optional
:access_level
,
type:
String
,
values:
Ci
::
Runner
.
access_levels
.
keys
,
optional
:access_level
,
type:
String
,
values:
Ci
::
Runner
.
access_levels
.
keys
,
desc:
'The access_level of the runner'
desc:
'The access_level of the runner'
optional
:job_upper_timeout
,
type:
Integer
,
desc:
'Upper timeout set when this Runner will handle the job'
at_least_one_of
:description
,
:active
,
:tag_list
,
:run_untagged
,
:locked
,
:access_level
at_least_one_of
:description
,
:active
,
:tag_list
,
:run_untagged
,
:locked
,
:access_level
end
end
put
':id'
do
put
':id'
do
...
...
spec/requests/api/runner_spec.rb
View file @
7b82f4ba
...
@@ -109,6 +109,16 @@ describe API::Runner do
...
@@ -109,6 +109,16 @@ describe API::Runner do
end
end
end
end
context
'when job upper timeout is specified'
do
it
'creates runner'
do
post
api
(
'/runners'
),
token:
registration_token
,
job_upper_timeout:
7200
expect
(
response
).
to
have_gitlab_http_status
201
expect
(
Ci
::
Runner
.
first
.
job_upper_timeout
).
to
eq
(
7200
)
end
end
%w(name version revision platform architecture)
.
each
do
|
param
|
%w(name version revision platform architecture)
.
each
do
|
param
|
context
"when info parameter '
#{
param
}
' info is present"
do
context
"when info parameter '
#{
param
}
' info is present"
do
let
(
:value
)
{
"
#{
param
}
_value"
}
let
(
:value
)
{
"
#{
param
}
_value"
}
...
...
spec/requests/api/runners_spec.rb
View file @
7b82f4ba
...
@@ -123,6 +123,7 @@ describe API::Runners do
...
@@ -123,6 +123,7 @@ describe API::Runners do
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
json_response
[
'description'
]).
to
eq
(
shared_runner
.
description
)
expect
(
json_response
[
'description'
]).
to
eq
(
shared_runner
.
description
)
expect
(
json_response
[
'job_upper_timeout'
]).
to
be_nil
end
end
end
end
...
@@ -192,7 +193,8 @@ describe API::Runners do
...
@@ -192,7 +193,8 @@ describe API::Runners do
tag_list:
[
'ruby2.1'
,
'pgsql'
,
'mysql'
],
tag_list:
[
'ruby2.1'
,
'pgsql'
,
'mysql'
],
run_untagged:
'false'
,
run_untagged:
'false'
,
locked:
'true'
,
locked:
'true'
,
access_level:
'ref_protected'
)
access_level:
'ref_protected'
,
job_upper_timeout:
1234
)
shared_runner
.
reload
shared_runner
.
reload
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
...
@@ -204,6 +206,7 @@ describe API::Runners do
...
@@ -204,6 +206,7 @@ describe API::Runners do
expect
(
shared_runner
.
ref_protected?
).
to
be_truthy
expect
(
shared_runner
.
ref_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
)
expect
(
shared_runner
.
job_upper_timeout
).
to
eq
(
1234
)
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