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
Léo-Paul Géneau
gitlab-ce
Commits
99caa5bb
Commit
99caa5bb
authored
Feb 27, 2018
by
Tomasz Maczukin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use ChronicDurationAttribute to handle CI/CD timeout setting
parent
b15dd5df
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
13 deletions
+12
-13
app/controllers/projects/pipelines_settings_controller.rb
app/controllers/projects/pipelines_settings_controller.rb
+1
-1
app/controllers/projects_controller.rb
app/controllers/projects_controller.rb
+1
-1
app/models/project.rb
app/models/project.rb
+7
-8
app/views/projects/pipelines_settings/_show.html.haml
app/views/projects/pipelines_settings/_show.html.haml
+3
-3
No files found.
app/controllers/projects/pipelines_settings_controller.rb
View file @
99caa5bb
...
...
@@ -36,7 +36,7 @@ class Projects::PipelinesSettingsController < Projects::ApplicationController
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 @
99caa5bb
...
...
@@ -324,7 +324,7 @@ class ProjectsController < Projects::ApplicationController
: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 @
99caa5bb
...
...
@@ -21,6 +21,7 @@ class Project < ActiveRecord::Base
include
Gitlab
::
SQL
::
Pattern
include
DeploymentPlatform
include
::
Gitlab
::
Utils
::
StrongMemoize
include
ChronicDurationAttribute
extend
Gitlab
::
ConfigHelper
...
...
@@ -325,6 +326,12 @@ class Project < ActiveRecord::Base
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 @@ class Project < ActiveRecord::Base
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 @
99caa5bb
...
...
@@ -73,10 +73,10 @@
%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
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
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