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
Jérome Perrin
gitlab-ce
Commits
f5e602ee
Commit
f5e602ee
authored
Mar 06, 2018
by
Tomasz Maczukin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename maximum_job_timeout to maximum_timeout
parent
1e138767
Changes
14
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
39 additions
and
30 deletions
+39
-30
app/models/ci/build_metadata.rb
app/models/ci/build_metadata.rb
+1
-1
app/models/ci/runner.rb
app/models/ci/runner.rb
+2
-2
app/views/projects/runners/_form.html.haml
app/views/projects/runners/_form.html.haml
+2
-2
app/views/projects/runners/show.html.haml
app/views/projects/runners/show.html.haml
+1
-1
db/migrate/20180219153455_add_maximum_timeout_to_ci_runners.rb
...grate/20180219153455_add_maximum_timeout_to_ci_runners.rb
+9
-0
db/schema.rb
db/schema.rb
+1
-1
doc/api/runners.md
doc/api/runners.md
+3
-3
lib/api/entities.rb
lib/api/entities.rb
+1
-1
lib/api/runner.rb
lib/api/runner.rb
+2
-2
lib/api/runners.rb
lib/api/runners.rb
+1
-1
spec/models/ci/build_spec.rb
spec/models/ci/build_spec.rb
+5
-5
spec/models/concerns/chronic_duration_attribute_spec.rb
spec/models/concerns/chronic_duration_attribute_spec.rb
+2
-2
spec/requests/api/runner_spec.rb
spec/requests/api/runner_spec.rb
+6
-6
spec/requests/api/runners_spec.rb
spec/requests/api/runners_spec.rb
+3
-3
No files found.
app/models/ci/build_metadata.rb
View file @
f5e602ee
...
...
@@ -20,7 +20,7 @@ module Ci
def
save_timeout_state!
project_timeout
=
build
.
project
&
.
build_timeout
timeout
=
[
project_timeout
,
build
.
runner
&
.
maximum_
job_
timeout
].
compact
.
min
timeout
=
[
project_timeout
,
build
.
runner
&
.
maximum_timeout
].
compact
.
min
self
.
used_timeout
=
timeout
self
.
timeout_source
=
timeout
<
project_timeout
?
:runner_timeout_source
:
:project_timeout_source
...
...
app/models/ci/runner.rb
View file @
f5e602ee
...
...
@@ -9,7 +9,7 @@ module Ci
ONLINE_CONTACT_TIMEOUT
=
1
.
hour
UPDATE_DB_RUNNER_INFO_EVERY
=
40
.
minutes
AVAILABLE_SCOPES
=
%w[specific shared active paused online]
.
freeze
FORM_EDITABLE
=
%i[description tag_list active run_untagged locked access_level maximum_
job_
timeout_human_readable]
.
freeze
FORM_EDITABLE
=
%i[description tag_list active run_untagged locked access_level maximum_timeout_human_readable]
.
freeze
has_many
:builds
has_many
:runner_projects
,
dependent: :destroy
# rubocop:disable Cop/ActiveRecordDependent
...
...
@@ -52,7 +52,7 @@ module Ci
cached_attr_reader
:version
,
:revision
,
:platform
,
:architecture
,
:contacted_at
,
:ip_address
chronic_duration_attr
:maximum_
job_timeout_human_readable
,
:maximum_job
_timeout
chronic_duration_attr
:maximum_
timeout_human_readable
,
:maximum
_timeout
# Searches for runners matching the given query.
#
...
...
app/views/projects/runners/_form.html.haml
View file @
f5e602ee
...
...
@@ -40,10 +40,10 @@
.col-sm-10
=
f
.
text_field
:description
,
class:
'form-control'
.form-group
=
label_tag
:maximum_
job_
timeout_human_readable
,
class:
'control-label'
do
=
label_tag
:maximum_timeout_human_readable
,
class:
'control-label'
do
Maximum job timeout
.col-sm-10
=
f
.
text_field
:maximum_
job_
timeout_human_readable
,
class:
'form-control'
=
f
.
text_field
:maximum_timeout_human_readable
,
class:
'form-control'
.help-block
This timeout will take precedence when lower than Project-defined timeout
.form-group
=
label_tag
:tag_list
,
class:
'control-label'
do
...
...
app/views/projects/runners/show.html.haml
View file @
f5e602ee
...
...
@@ -57,7 +57,7 @@
%td
=
@runner
.
description
%tr
%td
Maximum job timeout
%td
=
@runner
.
maximum_
job_
timeout_human_readable
%td
=
@runner
.
maximum_timeout_human_readable
%tr
%td
Last contact
%td
...
...
db/migrate/20180219153455_add_maximum_
job_
timeout_to_ci_runners.rb
→
db/migrate/20180219153455_add_maximum_timeout_to_ci_runners.rb
View file @
f5e602ee
class
AddMaximum
Job
TimeoutToCiRunners
<
ActiveRecord
::
Migration
class
AddMaximumTimeoutToCiRunners
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
def
change
add_column
:ci_runners
,
:maximum_
job_
timeout
,
:integer
add_column
:ci_runners
,
:maximum_timeout
,
:integer
end
end
db/schema.rb
View file @
f5e602ee
...
...
@@ -463,7 +463,7 @@ ActiveRecord::Schema.define(version: 20180327101207) do
t
.
boolean
"run_untagged"
,
default:
true
,
null:
false
t
.
boolean
"locked"
,
default:
false
,
null:
false
t
.
integer
"access_level"
,
default:
0
,
null:
false
t
.
integer
"maximum_
job_
timeout"
t
.
integer
"maximum_timeout"
t
.
string
"ip_address"
end
...
...
doc/api/runners.md
View file @
f5e602ee
...
...
@@ -154,7 +154,7 @@ Example response:
],
"version"
:
null
,
"access_level"
:
"ref_protected"
,
"maximum_
job_
timeout"
:
3600
"maximum_timeout"
:
3600
}
```
...
...
@@ -175,7 +175,7 @@ PUT /runners/:id
|
`run_untagged`
| boolean | no | Flag indicating the runner can execute untagged jobs |
|
`locked`
| boolean | no | Flag indicating the runner is locked |
|
`access_level`
| string | no | The access_level of the runner;
`not_protected`
or
`ref_protected`
|
|
`maximum_
job_
timeout`
| integer | no | Maximum timeout set when this Runner will handle the job |
|
`maximum_timeout`
| integer | no | Maximum 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"
...
...
@@ -214,7 +214,7 @@ Example response:
],
"version"
:
null
,
"access_level"
:
"ref_protected"
,
"maximum_
job_
timeout"
:
null
"maximum_timeout"
:
null
}
```
...
...
lib/api/entities.rb
View file @
f5e602ee
...
...
@@ -951,7 +951,7 @@ module API
expose
:tag_list
expose
:run_untagged
expose
:locked
expose
:maximum_
job_
timeout
expose
:maximum_timeout
expose
:access_level
expose
:version
,
:revision
,
:platform
,
:architecture
expose
:contacted_at
...
...
lib/api/runner.rb
View file @
f5e602ee
...
...
@@ -14,12 +14,12 @@ module API
optional
:locked
,
type:
Boolean
,
desc:
'Should Runner be locked for current project'
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_
job_
timeout
,
type:
String
,
desc:
'Maximum timeout set when this Runner will handle the job'
optional
:maximum_timeout
,
type:
String
,
desc:
'Maximum timeout set when this Runner will handle the job'
end
post
'/'
do
attributes
=
attributes_for_keys
([
:description
,
:locked
,
:run_untagged
,
:tag_list
])
.
merge
(
get_runner_details_from_request
)
.
merge
(
maximum_
job_timeout_human_readable:
params
[
:maximum_job
_timeout
])
.
merge
(
maximum_
timeout_human_readable:
params
[
:maximum
_timeout
])
runner
=
if
runner_registration_token_valid?
...
...
lib/api/runners.rb
View file @
f5e602ee
...
...
@@ -57,7 +57,7 @@ module API
optional
:locked
,
type:
Boolean
,
desc:
'Flag indicating the runner is locked'
optional
:access_level
,
type:
String
,
values:
Ci
::
Runner
.
access_levels
.
keys
,
desc:
'The access_level of the runner'
optional
:maximum_
job_
timeout
,
type:
Integer
,
desc:
'Maximum timeout set when this Runner will handle the job'
optional
:maximum_timeout
,
type:
Integer
,
desc:
'Maximum timeout set when this Runner will handle the job'
at_least_one_of
:description
,
:active
,
:tag_list
,
:run_untagged
,
:locked
,
:access_level
end
put
':id'
do
...
...
spec/models/ci/build_spec.rb
View file @
f5e602ee
...
...
@@ -1288,7 +1288,7 @@ describe Ci::Build do
end
context
'when runner sets timeout to bigger value'
do
let
(
:runner2
)
{
create
(
:ci_runner
,
maximum_
job_
timeout:
2000
)
}
let
(
:runner2
)
{
create
(
:ci_runner
,
maximum_timeout:
2000
)
}
let
(
:build
)
{
create
(
:ci_build
,
:pending
,
pipeline:
pipeline2
,
runner:
runner2
)
}
it
'returns project timeout configuration'
do
...
...
@@ -1297,11 +1297,11 @@ describe Ci::Build do
end
context
'when runner sets timeout to smaller value'
do
let
(
:runner2
)
{
create
(
:ci_runner
,
maximum_
job_
timeout:
500
)
}
let
(
:runner2
)
{
create
(
:ci_runner
,
maximum_timeout:
500
)
}
let
(
:build
)
{
create
(
:ci_build
,
:pending
,
pipeline:
pipeline2
,
runner:
runner2
)
}
it
'returns project timeout configuration'
do
is_expected
.
to
eq
(
runner2
.
maximum_
job_
timeout
)
is_expected
.
to
eq
(
runner2
.
maximum_timeout
)
end
end
end
...
...
@@ -2064,7 +2064,7 @@ describe Ci::Build do
let
(
:expected_timeout_source
)
{
'runner_timeout_source'
}
before
do
runner
.
maximum_
job_
timeout
=
900
runner
.
maximum_timeout
=
900
runner
.
save!
end
...
...
@@ -2076,7 +2076,7 @@ describe Ci::Build do
let
(
:expected_timeout_source
)
{
'project_timeout_source'
}
before
do
runner
.
maximum_
job_
timeout
=
3600
runner
.
maximum_timeout
=
3600
runner
.
save!
end
...
...
spec/models/concerns/chronic_duration_attribute_spec.rb
View file @
f5e602ee
...
...
@@ -55,8 +55,8 @@ shared_examples 'ChronicDurationAttribute writer' do
end
describe
'ChronicDurationAttribute'
do
let
(
:source_field
)
{
:maximum_
job_
timeout
}
let
(
:virtual_field
)
{
:maximum_
job_
timeout_human_readable
}
let
(
:source_field
)
{
:maximum_timeout
}
let
(
:virtual_field
)
{
:maximum_timeout_human_readable
}
subject
{
Ci
::
Runner
.
new
}
...
...
spec/requests/api/runner_spec.rb
View file @
f5e602ee
...
...
@@ -112,19 +112,19 @@ describe API::Runner do
context
'when maximum job timeout is specified'
do
it
'creates runner'
do
post
api
(
'/runners'
),
token:
registration_token
,
maximum_
job_
timeout:
'2h 30m'
maximum_timeout:
'2h 30m'
expect
(
response
).
to
have_gitlab_http_status
201
expect
(
Ci
::
Runner
.
first
.
maximum_
job_
timeout
).
to
eq
(
9000
)
expect
(
Ci
::
Runner
.
first
.
maximum_timeout
).
to
eq
(
9000
)
end
context
'when maximum job timeout is empty'
do
it
'creates runner'
do
post
api
(
'/runners'
),
token:
registration_token
,
maximum_
job_
timeout:
''
maximum_timeout:
''
expect
(
response
).
to
have_gitlab_http_status
201
expect
(
Ci
::
Runner
.
first
.
maximum_
job_
timeout
).
to
be_nil
expect
(
Ci
::
Runner
.
first
.
maximum_timeout
).
to
be_nil
end
end
end
...
...
@@ -681,7 +681,7 @@ describe API::Runner do
end
context
'when runner specifies lower timeout'
do
let
(
:runner
)
{
create
(
:ci_runner
,
maximum_
job_
timeout:
1000
)
}
let
(
:runner
)
{
create
(
:ci_runner
,
maximum_timeout:
1000
)
}
it
'contains info about timeout overridden by runner'
do
request_job
...
...
@@ -692,7 +692,7 @@ describe API::Runner do
end
context
'when runner specifies bigger timeout'
do
let
(
:runner
)
{
create
(
:ci_runner
,
maximum_
job_
timeout:
2000
)
}
let
(
:runner
)
{
create
(
:ci_runner
,
maximum_timeout:
2000
)
}
it
'contains info about timeout not overridden by runner'
do
request_job
...
...
spec/requests/api/runners_spec.rb
View file @
f5e602ee
...
...
@@ -123,7 +123,7 @@ describe API::Runners do
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
json_response
[
'description'
]).
to
eq
(
shared_runner
.
description
)
expect
(
json_response
[
'maximum_
job_
timeout'
]).
to
be_nil
expect
(
json_response
[
'maximum_timeout'
]).
to
be_nil
end
end
...
...
@@ -194,7 +194,7 @@ describe API::Runners do
run_untagged:
'false'
,
locked:
'true'
,
access_level:
'ref_protected'
,
maximum_
job_
timeout:
1234
)
maximum_timeout:
1234
)
shared_runner
.
reload
expect
(
response
).
to
have_gitlab_http_status
(
200
)
...
...
@@ -206,7 +206,7 @@ describe API::Runners do
expect
(
shared_runner
.
ref_protected?
).
to
be_truthy
expect
(
shared_runner
.
ensure_runner_queue_value
)
.
not_to
eq
(
runner_queue_value
)
expect
(
shared_runner
.
maximum_
job_
timeout
).
to
eq
(
1234
)
expect
(
shared_runner
.
maximum_timeout
).
to
eq
(
1234
)
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