diff --git a/app/models/ci/runner.rb b/app/models/ci/runner.rb index 62cc636db22..5a4c56ec0dc 100644 --- a/app/models/ci/runner.rb +++ b/app/models/ci/runner.rb @@ -54,6 +54,10 @@ module Ci chronic_duration_attr :maximum_timeout_human_readable, :maximum_timeout + validates :maximum_timeout, allow_nil: true, + numericality: { greater_than_or_equal_to: 600, + message: 'needs to be at least 10 minutes' } + # Searches for runners matching the given query. # # This method uses ILIKE on PostgreSQL and LIKE on MySQL. diff --git a/spec/models/ci/build_spec.rb b/spec/models/ci/build_spec.rb index b209d53ae08..14dec2d4fc9 100644 --- a/spec/models/ci/build_spec.rb +++ b/spec/models/ci/build_spec.rb @@ -1299,7 +1299,7 @@ describe Ci::Build do end context 'when runner sets timeout to smaller value' do - let(:runner2) { create(:ci_runner, maximum_timeout: 500) } + let(:runner2) { create(:ci_runner, maximum_timeout: 600) } let(:build) { create(:ci_build, :pending, pipeline: pipeline2, runner: runner2) } it 'returns project timeout configuration' do