From 7b82f4bab1661d7f7e7cb044730c977329275240 Mon Sep 17 00:00:00 2001 From: Tomasz Maczukin Date: Mon, 19 Feb 2018 17:21:00 +0100 Subject: Add support for job_upper_timeout in API --- lib/api/entities.rb | 1 + lib/api/runner.rb | 3 ++- lib/api/runners.rb | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/api/entities.rb b/lib/api/entities.rb index 16147ee90c9..becd4f22a03 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -951,6 +951,7 @@ module API expose :tag_list expose :run_untagged expose :locked + expose :job_upper_timeout expose :access_level expose :version, :revision, :platform, :architecture expose :contacted_at diff --git a/lib/api/runner.rb b/lib/api/runner.rb index 8da97a97754..14dd3b81dd0 100644 --- a/lib/api/runner.rb +++ b/lib/api/runner.rb @@ -14,9 +14,10 @@ module API optional :locked, type: Boolean, desc: 'Should Runner be locked for current project' optional :run_untagged, type: Boolean, desc: 'Should Runner handle untagged jobs' optional :tag_list, type: Array[String], desc: %q(List of Runner's tags) + optional :job_upper_timeout, type: Integer, desc: 'Upper timeout set when this Runner will handle the job' end post '/' do - attributes = attributes_for_keys([:description, :locked, :run_untagged, :tag_list]) + attributes = attributes_for_keys([:description, :locked, :run_untagged, :tag_list, :job_upper_timeout]) .merge(get_runner_details_from_request) runner = diff --git a/lib/api/runners.rb b/lib/api/runners.rb index 996457c5dfe..bc91b7cfd54 100644 --- a/lib/api/runners.rb +++ b/lib/api/runners.rb @@ -57,6 +57,7 @@ module API optional :locked, type: Boolean, desc: 'Flag indicating the runner is locked' optional :access_level, type: String, values: Ci::Runner.access_levels.keys, desc: 'The access_level of the runner' + optional :job_upper_timeout, type: Integer, desc: 'Upper timeout set when this Runner will handle the job' at_least_one_of :description, :active, :tag_list, :run_untagged, :locked, :access_level end put ':id' do -- cgit v1.2.1 From d633bc8134fe472137fb668c1eb78de45dc9bb57 Mon Sep 17 00:00:00 2001 From: Tomasz Maczukin Date: Wed, 21 Feb 2018 01:21:59 +0100 Subject: Rename job_upper_timeout to maximum_job_timeout --- lib/api/entities.rb | 2 +- lib/api/runner.rb | 4 ++-- lib/api/runners.rb | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/api/entities.rb b/lib/api/entities.rb index becd4f22a03..bb18fa00dc6 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -951,7 +951,7 @@ module API expose :tag_list expose :run_untagged expose :locked - expose :job_upper_timeout + expose :maximum_job_timeout expose :access_level expose :version, :revision, :platform, :architecture expose :contacted_at diff --git a/lib/api/runner.rb b/lib/api/runner.rb index 14dd3b81dd0..3a26155be6d 100644 --- a/lib/api/runner.rb +++ b/lib/api/runner.rb @@ -14,10 +14,10 @@ module API optional :locked, type: Boolean, desc: 'Should Runner be locked for current project' optional :run_untagged, type: Boolean, desc: 'Should Runner handle untagged jobs' optional :tag_list, type: Array[String], desc: %q(List of Runner's tags) - optional :job_upper_timeout, type: Integer, desc: 'Upper timeout set when this Runner will handle the job' + optional :maximum_job_timeout, type: Integer, desc: 'Maximum timeout set when this Runner will handle the job' end post '/' do - attributes = attributes_for_keys([:description, :locked, :run_untagged, :tag_list, :job_upper_timeout]) + attributes = attributes_for_keys([:description, :locked, :run_untagged, :tag_list, :maximum_job_timeout]) .merge(get_runner_details_from_request) runner = diff --git a/lib/api/runners.rb b/lib/api/runners.rb index bc91b7cfd54..b3037235353 100644 --- a/lib/api/runners.rb +++ b/lib/api/runners.rb @@ -57,7 +57,7 @@ module API optional :locked, type: Boolean, desc: 'Flag indicating the runner is locked' optional :access_level, type: String, values: Ci::Runner.access_levels.keys, desc: 'The access_level of the runner' - optional :job_upper_timeout, type: Integer, desc: 'Upper timeout set when this Runner will handle the job' + optional :maximum_job_timeout, type: Integer, desc: 'Maximum timeout set when this Runner will handle the job' at_least_one_of :description, :active, :tag_list, :run_untagged, :locked, :access_level end put ':id' do -- cgit v1.2.1 From dbd7455583a10679f0e365cfeacd4729a4b543ec Mon Sep 17 00:00:00 2001 From: Tomasz Maczukin Date: Wed, 28 Feb 2018 20:56:35 +0100 Subject: Use _human_readable for Runner's registration API --- lib/api/runner.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/api/runner.rb b/lib/api/runner.rb index 3a26155be6d..74ddaf26bb6 100644 --- a/lib/api/runner.rb +++ b/lib/api/runner.rb @@ -14,10 +14,10 @@ module API optional :locked, type: Boolean, desc: 'Should Runner be locked for current project' optional :run_untagged, type: Boolean, desc: 'Should Runner handle untagged jobs' optional :tag_list, type: Array[String], desc: %q(List of Runner's tags) - optional :maximum_job_timeout, type: Integer, desc: 'Maximum timeout set when this Runner will handle the job' + optional :maximum_job_timeout_human_readable, type: String, desc: 'Maximum timeout set when this Runner will handle the job' end post '/' do - attributes = attributes_for_keys([:description, :locked, :run_untagged, :tag_list, :maximum_job_timeout]) + attributes = attributes_for_keys([:description, :locked, :run_untagged, :tag_list, :maximum_job_timeout_human_readable]) .merge(get_runner_details_from_request) runner = -- cgit v1.2.1 From 62f053e4e50dd04933d49622a74dcb89ebe8174e Mon Sep 17 00:00:00 2001 From: Tomasz Maczukin Date: Mon, 5 Mar 2018 17:49:40 +0100 Subject: Update runner registration API --- lib/api/runner.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/api/runner.rb b/lib/api/runner.rb index 74ddaf26bb6..73d5993701c 100644 --- a/lib/api/runner.rb +++ b/lib/api/runner.rb @@ -14,11 +14,12 @@ module API optional :locked, type: Boolean, desc: 'Should Runner be locked for current project' optional :run_untagged, type: Boolean, desc: 'Should Runner handle untagged jobs' optional :tag_list, type: Array[String], desc: %q(List of Runner's tags) - optional :maximum_job_timeout_human_readable, type: String, desc: 'Maximum timeout set when this Runner will handle the job' + optional :maximum_job_timeout, type: String, desc: 'Maximum timeout set when this Runner will handle the job' end post '/' do - attributes = attributes_for_keys([:description, :locked, :run_untagged, :tag_list, :maximum_job_timeout_human_readable]) + attributes = attributes_for_keys([:description, :locked, :run_untagged, :tag_list]) .merge(get_runner_details_from_request) + .merge(maximum_job_timeout_human_readable: params[:maximum_job_timeout]) runner = if runner_registration_token_valid? -- cgit v1.2.1 From f5e602ee0f8d95617adf6fb9b5a1a132a471fb12 Mon Sep 17 00:00:00 2001 From: Tomasz Maczukin Date: Tue, 6 Mar 2018 16:14:23 +0100 Subject: Rename maximum_job_timeout to maximum_timeout --- lib/api/entities.rb | 2 +- lib/api/runner.rb | 4 ++-- lib/api/runners.rb | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/api/entities.rb b/lib/api/entities.rb index bb18fa00dc6..324e14f5654 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -951,7 +951,7 @@ module API expose :tag_list expose :run_untagged expose :locked - expose :maximum_job_timeout + expose :maximum_timeout expose :access_level expose :version, :revision, :platform, :architecture expose :contacted_at diff --git a/lib/api/runner.rb b/lib/api/runner.rb index 73d5993701c..95f57e6402d 100644 --- a/lib/api/runner.rb +++ b/lib/api/runner.rb @@ -14,12 +14,12 @@ module API optional :locked, type: Boolean, desc: 'Should Runner be locked for current project' optional :run_untagged, type: Boolean, desc: 'Should Runner handle untagged jobs' optional :tag_list, type: Array[String], desc: %q(List of Runner's tags) - optional :maximum_job_timeout, type: String, desc: 'Maximum timeout set when this Runner will handle the job' + optional :maximum_timeout, type: String, desc: 'Maximum timeout set when this Runner will handle the job' end post '/' do attributes = attributes_for_keys([:description, :locked, :run_untagged, :tag_list]) .merge(get_runner_details_from_request) - .merge(maximum_job_timeout_human_readable: params[:maximum_job_timeout]) + .merge(maximum_timeout_human_readable: params[:maximum_timeout]) runner = if runner_registration_token_valid? diff --git a/lib/api/runners.rb b/lib/api/runners.rb index b3037235353..5f2a9567605 100644 --- a/lib/api/runners.rb +++ b/lib/api/runners.rb @@ -57,7 +57,7 @@ module API optional :locked, type: Boolean, desc: 'Flag indicating the runner is locked' optional :access_level, type: String, values: Ci::Runner.access_levels.keys, desc: 'The access_level of the runner' - optional :maximum_job_timeout, type: Integer, desc: 'Maximum timeout set when this Runner will handle the job' + optional :maximum_timeout, type: Integer, desc: 'Maximum timeout set when this Runner will handle the job' at_least_one_of :description, :active, :tag_list, :run_untagged, :locked, :access_level end put ':id' do -- cgit v1.2.1 From 557c85a79f141e435c56d971d813f492978bad61 Mon Sep 17 00:00:00 2001 From: Tomasz Maczukin Date: Wed, 21 Mar 2018 02:02:38 +0100 Subject: Use raw value of maximum_timeout for Runner registration API --- lib/api/runner.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/api/runner.rb b/lib/api/runner.rb index 95f57e6402d..57c0a729535 100644 --- a/lib/api/runner.rb +++ b/lib/api/runner.rb @@ -14,12 +14,11 @@ module API optional :locked, type: Boolean, desc: 'Should Runner be locked for current project' optional :run_untagged, type: Boolean, desc: 'Should Runner handle untagged jobs' optional :tag_list, type: Array[String], desc: %q(List of Runner's tags) - optional :maximum_timeout, type: String, desc: 'Maximum timeout set when this Runner will handle the job' + optional :maximum_timeout, type: Integer, desc: 'Maximum timeout set when this Runner will handle the job' end post '/' do - attributes = attributes_for_keys([:description, :locked, :run_untagged, :tag_list]) + attributes = attributes_for_keys([:description, :locked, :run_untagged, :tag_list, :maximum_timeout]) .merge(get_runner_details_from_request) - .merge(maximum_timeout_human_readable: params[:maximum_timeout]) runner = if runner_registration_token_valid? -- cgit v1.2.1 From 6ecde0076afa83e30608ea9caba924bbab66a123 Mon Sep 17 00:00:00 2001 From: Tomasz Maczukin Date: Mon, 26 Mar 2018 19:26:52 +0200 Subject: Remove Ci::Build#timeout --- lib/api/entities.rb | 2 +- lib/gitlab/ci/build/step.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/api/entities.rb b/lib/api/entities.rb index 324e14f5654..38161d1f127 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -1120,7 +1120,7 @@ module API end class RunnerInfo < Grape::Entity - expose :timeout + expose :metadata_timeout, as: :timeout end class Step < Grape::Entity diff --git a/lib/gitlab/ci/build/step.rb b/lib/gitlab/ci/build/step.rb index 411f67f8ce7..0b1ebe4e048 100644 --- a/lib/gitlab/ci/build/step.rb +++ b/lib/gitlab/ci/build/step.rb @@ -14,7 +14,7 @@ module Gitlab self.new(:script).tap do |step| step.script = job.options[:before_script].to_a + job.options[:script].to_a step.script = job.commands.split("\n") if step.script.empty? - step.timeout = job.timeout + step.timeout = job.metadata_timeout step.when = WHEN_ON_SUCCESS end end @@ -25,7 +25,7 @@ module Gitlab self.new(:after_script).tap do |step| step.script = after_script - step.timeout = job.timeout + step.timeout = job.metadata_timeout step.when = WHEN_ALWAYS step.allow_failure = true end -- cgit v1.2.1