summaryrefslogtreecommitdiff
path: root/app/models/project.rb
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2019-07-23 11:57:30 +0000
committerSean McGivern <sean@gitlab.com>2019-07-23 11:57:30 +0000
commitb2e4a7957ab7ae8e4ed5ae1fd4c0f3f826f26777 (patch)
tree69563679e9d5093a8ec884a9f3b6ba5962176f82 /app/models/project.rb
parent69adeb3718099de8bbf3090251d0061e90cada14 (diff)
parent41b8dca877ba790cd56677dc6405e16b631f9854 (diff)
downloadgitlab-ce-b2e4a7957ab7ae8e4ed5ae1fd4c0f3f826f26777.tar.gz
Merge branch 'gsemet/gitlab-ce-gsemet-master-patch-33258' into 'master'
Multiple pipeline support for Build status See merge request gitlab-org/gitlab-ce!30828
Diffstat (limited to 'app/models/project.rb')
-rw-r--r--app/models/project.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index ece7507e55c..8030c645e2e 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -1481,12 +1481,20 @@ class Project < ApplicationRecord
!namespace.share_with_group_lock
end
- def pipeline_for(ref, sha = nil)
+ def pipeline_for(ref, sha = nil, id = nil)
+ if id.present?
+ pipelines_for(ref, sha).find_by(id: id)
+ else
+ pipelines_for(ref, sha).take
+ end
+ end
+
+ def pipelines_for(ref, sha = nil)
sha ||= commit(ref).try(:sha)
return unless sha
- ci_pipelines.order(id: :desc).find_by(sha: sha, ref: ref)
+ ci_pipelines.order(id: :desc).where(sha: sha, ref: ref)
end
def latest_successful_pipeline_for_default_branch