diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2018-12-05 14:21:27 +0000 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2018-12-05 14:21:27 +0000 |
commit | af048f22f8fd42849dbaf7ed9801ee6d13bf8611 (patch) | |
tree | 85317b56abc51fe7ab4a8a6f4895444796d65049 /app/models | |
parent | 61bc233ef0df1395ad82ec8d48ee4dfd8c67e0be (diff) | |
parent | 35337177b4488714cf8f758d8697294a555ef3a5 (diff) | |
download | gitlab-ce-af048f22f8fd42849dbaf7ed9801ee6d13bf8611.tar.gz |
Merge branch 'fix/gb/improve-timeout-inputs-help-sections' into 'master'
Improve help and validation sections of maximum build timeout inputs
Closes #49434
See merge request gitlab-org/gitlab-ce!23586
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/ci/runner.rb | 3 | ||||
-rw-r--r-- | app/models/concerns/chronic_duration_attribute.rb | 2 | ||||
-rw-r--r-- | app/models/project.rb | 3 |
3 files changed, 5 insertions, 3 deletions
diff --git a/app/models/ci/runner.rb b/app/models/ci/runner.rb index 260348c97b2..2693386443a 100644 --- a/app/models/ci/runner.rb +++ b/app/models/ci/runner.rb @@ -114,7 +114,8 @@ module Ci cached_attr_reader :version, :revision, :platform, :architecture, :ip_address, :contacted_at - chronic_duration_attr :maximum_timeout_human_readable, :maximum_timeout + chronic_duration_attr :maximum_timeout_human_readable, :maximum_timeout, + error_message: 'Maximum job timeout has a value which could not be accepted' validates :maximum_timeout, allow_nil: true, numericality: { greater_than_or_equal_to: 600, diff --git a/app/models/concerns/chronic_duration_attribute.rb b/app/models/concerns/chronic_duration_attribute.rb index edf6ac96730..af4905115b1 100644 --- a/app/models/concerns/chronic_duration_attribute.rb +++ b/app/models/concerns/chronic_duration_attribute.rb @@ -24,7 +24,7 @@ module ChronicDurationAttribute end end - validates virtual_attribute, allow_nil: true, duration: true + validates virtual_attribute, allow_nil: true, duration: { message: parameters[:error_message] } end alias_method :chronic_duration_attr, :chronic_duration_attr_writer diff --git a/app/models/project.rb b/app/models/project.rb index 6ec323b58c2..d8ce8038e92 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -384,7 +384,8 @@ class Project < ActiveRecord::Base enum auto_cancel_pending_pipelines: { disabled: 0, enabled: 1 } - chronic_duration_attr :build_timeout_human_readable, :build_timeout, default: 3600 + chronic_duration_attr :build_timeout_human_readable, :build_timeout, + default: 3600, error_message: 'Maximum job timeout has a value which could not be accepted' validates :build_timeout, allow_nil: true, numericality: { greater_than_or_equal_to: 10.minutes, |