summaryrefslogtreecommitdiff
path: root/app/models/commit_status.rb
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2017-04-06 21:32:56 +0800
committerLin Jen-Shin <godfat@godfat.org>2017-04-06 21:32:56 +0800
commit057c0d7a5c062f3030bcc46614ef2442009002de (patch)
treee4e9f8b092500950e914955f8d257c3b443a77dd /app/models/commit_status.rb
parent98a4aca6b5ce503543b0e325212265a365e64d75 (diff)
downloadgitlab-ce-057c0d7a5c062f3030bcc46614ef2442009002de.tar.gz
Also track auto-cancelling in jobs, detail:
Not only tracking auto-cancelling in pipelines, we'll also track this in jobs because pipelines could be retried and the information would get lost when this happened. Also erase auto-cancelling relation for pipelines when they're retried.
Diffstat (limited to 'app/models/commit_status.rb')
-rw-r--r--app/models/commit_status.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb
index 17b322b5ae3..2c4033146bf 100644
--- a/app/models/commit_status.rb
+++ b/app/models/commit_status.rb
@@ -7,6 +7,7 @@ class CommitStatus < ActiveRecord::Base
belongs_to :project
belongs_to :pipeline, class_name: 'Ci::Pipeline', foreign_key: :commit_id
+ belongs_to :auto_canceled_by, class_name: 'Ci::Pipeline'
belongs_to :user
delegate :commit, to: :pipeline
@@ -137,6 +138,10 @@ class CommitStatus < ActiveRecord::Base
false
end
+ def auto_canceled?
+ canceled? && auto_canceled_by_id?
+ end
+
# Added in 9.0 to keep backward compatibility for projects exported in 8.17
# and prior.
def gl_project_id