diff options
author | Shinya Maeda <shinya@gitlab.com> | 2019-04-03 16:44:51 +0700 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2019-04-05 09:26:56 +0700 |
commit | fa73f4ee196b8c9d28c3b0b035acdd71d71dadb3 (patch) | |
tree | 16233cb3f29ad35978af388108a0020b29f49eba /app | |
parent | b54228ad3d79dc0bd7060128e0b75f68cd1c51d9 (diff) | |
download | gitlab-ce-fa73f4ee196b8c9d28c3b0b035acdd71d71dadb3.tar.gz |
Fix merge requst relationships with pipeline in MWPSServicefix-merge-request-relations-with-pipeline-on-mwps
MWPSService currently uses the old pipeline lookup method. It searches
related merge requests with pipeline.ref, however, this doesn't work
for attached/detached merge request pipelines.
Diffstat (limited to 'app')
-rw-r--r-- | app/services/merge_requests/add_todo_when_build_fails_service.rb | 4 | ||||
-rw-r--r-- | app/services/merge_requests/base_service.rb | 13 |
2 files changed, 3 insertions, 14 deletions
diff --git a/app/services/merge_requests/add_todo_when_build_fails_service.rb b/app/services/merge_requests/add_todo_when_build_fails_service.rb index 79c43b8e7d5..d3ef892875b 100644 --- a/app/services/merge_requests/add_todo_when_build_fails_service.rb +++ b/app/services/merge_requests/add_todo_when_build_fails_service.rb @@ -7,7 +7,7 @@ module MergeRequests def execute(commit_status) return if commit_status.allow_failure? || commit_status.retried? - commit_status_merge_requests(commit_status) do |merge_request| + pipeline_merge_requests(commit_status.pipeline) do |merge_request| todo_service.merge_request_build_failed(merge_request) end end @@ -16,7 +16,7 @@ module MergeRequests # build is retried # def close(commit_status) - commit_status_merge_requests(commit_status) do |merge_request| + pipeline_merge_requests(commit_status.pipeline) do |merge_request| todo_service.merge_request_build_retried(merge_request) end end diff --git a/app/services/merge_requests/base_service.rb b/app/services/merge_requests/base_service.rb index f968e3693da..8a9e5ebb014 100644 --- a/app/services/merge_requests/base_service.rb +++ b/app/services/merge_requests/base_service.rb @@ -99,22 +99,11 @@ module MergeRequests # rubocop: enable CodeReuse/ActiveRecord def pipeline_merge_requests(pipeline) - merge_requests_for(pipeline.ref).each do |merge_request| + pipeline.all_merge_requests.opened.each do |merge_request| next unless pipeline == merge_request.head_pipeline yield merge_request end end - - def commit_status_merge_requests(commit_status) - merge_requests_for(commit_status.ref).each do |merge_request| - pipeline = merge_request.head_pipeline - - next unless pipeline - next unless pipeline.sha == commit_status.sha - - yield merge_request - end - end end end |