Skip to content

Fix duplicate merge request pipelines created by Sidekiq worker retry

Shinya Maeda requested to merge fix-merge-request-pipeline-exist-method into master

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) into sha column. Thus diff_head_sha never matches those shas. We have to use for_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?

Edited by Shinya Maeda

Merge request reports