summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorTomasz Maczukin <tomasz@maczukin.pl>2018-02-19 18:23:12 +0100
committerTomasz Maczukin <tomasz@maczukin.pl>2018-03-28 13:55:46 +0200
commit834f473821b816515504abb7c6bc91ab2dee4450 (patch)
tree5559e17ce6cced507d87ea53729875059378df45 /app/models
parent7b82f4bab1661d7f7e7cb044730c977329275240 (diff)
downloadgitlab-ce-834f473821b816515504abb7c6bc91ab2dee4450.tar.gz
Override project-defined timeout with runner-defined one
Diffstat (limited to 'app/models')
-rw-r--r--app/models/ci/build.rb7
-rw-r--r--app/models/ci/runner.rb4
2 files changed, 11 insertions, 0 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index 08bb5915d10..e15c4bc6ceb 100644
--- a/app/models/ci/build.rb
+++ b/app/models/ci/build.rb
@@ -232,9 +232,16 @@ module Ci
end
def timeout
+ return runner.job_upper_timeout if should_use_runner_timeout
+
project.build_timeout
end
+ def should_use_runner_timeout
+ runner && runner.defines_job_upper_timeout? && runner.job_upper_timeout < project.build_timeout
+ end
+ private :should_use_runner_timeout
+
def triggered_by?(current_user)
user == current_user
end
diff --git a/app/models/ci/runner.rb b/app/models/ci/runner.rb
index 7173f88f1c7..b28e892dcb6 100644
--- a/app/models/ci/runner.rb
+++ b/app/models/ci/runner.rb
@@ -167,6 +167,10 @@ module Ci
end
end
+ def defines_job_upper_timeout?
+ job_upper_timeout && job_upper_timeout > 0
+ end
+
private
def cleanup_runner_queue