Fix duplicate merge request pipelines created by Sidekiq worker retry
What does this MR do?
Currently, MergeRequest#merge_request_pipeline_exists?
has several problems.
- The name. We changed the terminology about merge request pipelines, and it's still referring to the old terminology.
- It cannot check if (attached) merge request pipelines exist or not. Because, merge request pipelines stores merge-sha (Generated by
MergeToRefService
) intosha
column. Thusdiff_head_sha
never matches those shas. We have to usefor_sha_or_source_sha
in this case. - We thrive reducing the number of scopes for "Find pipelines for merge requests" in
MergeRequest
model, and having a dedicated method for compatible any cases. This is good from two PoV 1) We can easily maintain 2) Reduce the number of mistakes from developers using a wrong method.
Related: https://gitlab.com/gitlab-org/gitlab-ee/issues/9186
What are the relevant issue numbers?
https://gitlab.com/gitlab-org/gitlab-ee/issues/7380
Does this MR meet the acceptance criteria?
- [-] Changelog entry added, if necessary
- [-] Documentation created/updated via this MR
- [-] Documentation reviewed by technical writer or follow-up review issue created
- [-] Tests added for this feature/bug
- [-] Tested in all supported browsers
-
Conforms to the code review guidelines -
Conforms to the merge request performance guidelines -
Conforms to the style guides -
Conforms to the database guides - [-] Link to e2e tests MR added if this MR has Requires e2e tests label. See the Test Planning Process.
-
Security reports checked/validated by reviewer
Edited by Shinya Maeda