Skip to content

Fix MergeToRefService raises Gitlab::Git::CommandError

What does this MR do?

Merge Train can be stuck when MergeToRefService raises Gitlab::Git::CommandError, which is raised when a conflict happens between source sha and target sha. In this case, you see the following error message

9:Failed to create merge commit for source_sha 6f58368d5bd670a583be2e2e68539d26209bb512 and target_sha fadc8b034cc244654ddb1706c020eb5543916405 at refs/merge-requests/42634/train

You can check on Kibana e.g. https://log.gprd.gitlab.net/goto/2c2468b1c8b7a823da09cb466bcfb5f0 or https://log.gprd.gitlab.net/goto/269bc8cbd5d9a3093f97b97e785bd3eb

We fix this problem by rescuing Gitlab::Git::CommandError exception in the service.

Close #208913 (closed)

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • [-] Label as security and @ mention @gitlab-com/gl-security/appsec
  • [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • [-] Security reports checked/validated by a reviewer from the AppSec team
Edited by Shinya Maeda

Merge request reports