From 4611a59968c65d1eda83af6c33bb844d9610fa12 Mon Sep 17 00:00:00 2001 From: Shinya Maeda Date: Sun, 28 Oct 2018 18:31:08 +0000 Subject: Add failure reason for execution timeout --- app/models/commit_status.rb | 3 ++- app/presenters/commit_status_presenter.rb | 3 ++- .../unreleased/add-failure-reason-for-execution-timeout.yml | 5 +++++ lib/gitlab/ci/status/build/failed.rb | 3 ++- spec/requests/api/runner_spec.rb | 9 +++++++++ 5 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 changelogs/unreleased/add-failure-reason-for-execution-timeout.yml diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb index 344f091c872..7d36f9982ab 100644 --- a/app/models/commit_status.rb +++ b/app/models/commit_status.rb @@ -50,7 +50,8 @@ class CommitStatus < ActiveRecord::Base runner_system_failure: 4, missing_dependency_failure: 5, runner_unsupported: 6, - stale_schedule: 7 + stale_schedule: 7, + job_execution_timeout: 8 } ## diff --git a/app/presenters/commit_status_presenter.rb b/app/presenters/commit_status_presenter.rb index 29eaad759bb..a866e76df5a 100644 --- a/app/presenters/commit_status_presenter.rb +++ b/app/presenters/commit_status_presenter.rb @@ -9,7 +9,8 @@ class CommitStatusPresenter < Gitlab::View::Presenter::Delegated runner_system_failure: 'There has been a runner system failure, please try again', missing_dependency_failure: 'There has been a missing dependency failure', runner_unsupported: 'Your runner is outdated, please upgrade your runner', - stale_schedule: 'Delayed job could not be executed by some reason, please try again' + stale_schedule: 'Delayed job could not be executed by some reason, please try again', + job_execution_timeout: 'The script exceeded the maximum execution time set for the job' }.freeze private_constant :CALLOUT_FAILURE_MESSAGES diff --git a/changelogs/unreleased/add-failure-reason-for-execution-timeout.yml b/changelogs/unreleased/add-failure-reason-for-execution-timeout.yml new file mode 100644 index 00000000000..c8488cbf200 --- /dev/null +++ b/changelogs/unreleased/add-failure-reason-for-execution-timeout.yml @@ -0,0 +1,5 @@ +--- +title: Add failure reason for execution timeout +merge_request: 22224 +author: +type: changed diff --git a/lib/gitlab/ci/status/build/failed.rb b/lib/gitlab/ci/status/build/failed.rb index 50b0d044265..4babc23a495 100644 --- a/lib/gitlab/ci/status/build/failed.rb +++ b/lib/gitlab/ci/status/build/failed.rb @@ -11,7 +11,8 @@ module Gitlab runner_system_failure: 'runner system failure', missing_dependency_failure: 'missing dependency failure', runner_unsupported: 'unsupported runner', - stale_schedule: 'stale schedule' + stale_schedule: 'stale schedule', + job_execution_timeout: 'job execution timeout' }.freeze private_constant :REASONS diff --git a/spec/requests/api/runner_spec.rb b/spec/requests/api/runner_spec.rb index c0d5a3ad74b..909703a8d47 100644 --- a/spec/requests/api/runner_spec.rb +++ b/spec/requests/api/runner_spec.rb @@ -806,6 +806,15 @@ describe API::Runner, :clean_gitlab_redis_shared_state do it { expect(job).to be_unknown_failure } end + + context 'when failure_reason is job_execution_timeout' do + before do + update_job(state: 'failed', failure_reason: 'job_execution_timeout') + job.reload + end + + it { expect(job).to be_job_execution_timeout } + end end context 'when trace is given' do -- cgit v1.2.1