diff options
author | Douwe Maan <douwe@gitlab.com> | 2017-09-05 16:06:31 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2017-09-05 16:06:31 +0000 |
commit | 4c6898bdcf0bff6a0a3b288215271be4e916b27c (patch) | |
tree | 13db382a777a55c8220fcbdd85ebf5bf4cedeb03 /app/models/commit_status.rb | |
parent | ae9b771797cceee76c18376910519e9e71628acc (diff) | |
parent | 063e285e6a8c26a95809873fb32fefc54fe9bdb6 (diff) | |
download | gitlab-ce-36860-migrate-issues-author.tar.gz |
Merge branch 'master' into '36860-migrate-issues-author'36860-migrate-issues-author
# Conflicts:
# db/schema.rb
Diffstat (limited to 'app/models/commit_status.rb')
-rw-r--r-- | app/models/commit_status.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb index 842c6e5cb50..f3888528940 100644 --- a/app/models/commit_status.rb +++ b/app/models/commit_status.rb @@ -38,6 +38,14 @@ class CommitStatus < ActiveRecord::Base scope :retried_ordered, -> { retried.ordered.includes(project: :namespace) } scope :after_stage, -> (index) { where('stage_idx > ?', index) } + enum failure_reason: { + unknown_failure: nil, + script_failure: 1, + api_failure: 2, + stuck_or_timeout_failure: 3, + runner_system_failure: 4 + } + state_machine :status do event :process do transition [:skipped, :manual] => :created @@ -79,6 +87,11 @@ class CommitStatus < ActiveRecord::Base commit_status.finished_at = Time.now end + before_transition any => :failed do |commit_status, transition| + failure_reason = transition.args.first + commit_status.failure_reason = failure_reason + end + after_transition do |commit_status, transition| next if transition.loopback? |