Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2019-07-23 14:57:30 +0300
committerSean McGivern <sean@gitlab.com>2019-07-23 14:57:30 +0300
commitb2e4a7957ab7ae8e4ed5ae1fd4c0f3f826f26777 (patch)
tree69563679e9d5093a8ec884a9f3b6ba5962176f82 /app
parent69adeb3718099de8bbf3090251d0061e90cada14 (diff)
parent41b8dca877ba790cd56677dc6405e16b631f9854 (diff)
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')
-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