Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
0b251ea3e741
Commit
0b251ea3
authored
Feb 27, 2018
by
Tomasz Maczukin
Browse files
Use ChronicDurationAttribute to handle CI/CD timeout setting
parent
a14c2aa5cb68
Changes
4
Hide whitespace changes
Inline
Side-by-side
app/controllers/projects/pipelines_settings_controller.rb
View file @
0b251ea3
...
...
@@ -36,7 +36,7 @@
def
update_params
params
.
require
(
:project
).
permit
(
:runners_token
,
:builds_enabled
,
:build_allow_git_fetch
,
:build_timeout_
in_minutes
,
:build_coverage_regex
,
:public_builds
,
:build_timeout_
human_readable
,
:build_coverage_regex
,
:public_builds
,
:auto_cancel_pending_pipelines
,
:ci_config_path
,
auto_devops_attributes:
[
:id
,
:domain
,
:enabled
]
)
...
...
app/controllers/projects_controller.rb
View file @
0b251ea3
...
...
@@ -324,7 +324,7 @@
:avatar
,
:build_allow_git_fetch
,
:build_coverage_regex
,
:build_timeout_
in_minutes
,
:build_timeout_
human_readable
,
:resolve_outdated_diff_discussions
,
:container_registry_enabled
,
:default_branch
,
...
...
app/models/project.rb
View file @
0b251ea3
...
...
@@ -21,6 +21,7 @@
include
Gitlab
::
SQL
::
Pattern
include
DeploymentPlatform
include
::
Gitlab
::
Utils
::
StrongMemoize
include
ChronicDurationAttribute
extend
Gitlab
::
ConfigHelper
...
...
@@ -325,6 +326,12 @@
enum
auto_cancel_pending_pipelines:
{
disabled:
0
,
enabled:
1
}
chronic_duration_attr
:build_timeout_human_readable
,
:build_timeout
validates
:build_timeout
,
allow_nil:
true
,
numericality:
{
greater_than_or_equal_to:
600
,
message:
'needs to be at least 10 minutes'
}
# Returns a collection of projects that is either public or visible to the
# logged in user.
def
self
.
public_or_visible_to_user
(
user
=
nil
)
...
...
@@ -1299,14 +1306,6 @@
self
.
runners_token
&&
ActiveSupport
::
SecurityUtils
.
variable_size_secure_compare
(
token
,
self
.
runners_token
)
end
def
build_timeout_in_minutes
build_timeout
/
60
end
def
build_timeout_in_minutes
=
(
value
)
self
.
build_timeout
=
value
.
to_i
*
60
end
def
open_issues_count
Projects
::
OpenIssuesCountService
.
new
(
self
).
count
end
...
...
app/views/projects/pipelines_settings/_show.html.haml
View file @
0b251ea3
...
...
@@ -73,6 +73,6 @@
%hr
.form-group
=
f
.
label
:build_timeout_
in_minutes
,
'Timeout'
,
class:
'label-light'
=
f
.
number
_field
:build_timeout_
in_minutes
,
class:
'form-control'
,
min:
'0'
=
f
.
label
:build_timeout_
human_readable
,
'Timeout'
,
class:
'label-light'
=
f
.
text
_field
:build_timeout_
human_readable
,
class:
'form-control'
%p
.help-block
...
...
@@ -78,5 +78,5 @@
%p
.help-block
Per job
in minutes
. If a job passes this threshold, it will be marked as failed
Per job. If a job passes this threshold, it will be marked as failed
=
link_to
icon
(
'question-circle'
),
help_page_path
(
'user/project/pipelines/settings'
,
anchor:
'timeout'
),
target:
'_blank'
%hr
...
...
Write
Preview
Supports
Markdown
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