Skip to content

Fix intermittent 'branch not found' errors when pushing creates an MR

Nick Thomas requested to merge 273131-fix-mr-create-push-option-race into master

What does this MR do?

When we push to create a merge request (-omr.create), we kick off an asynchronous PostReceive worker job, then synchronously create a merge request. This requires the target branch (but not the source branch) to exist in the repository, so we check when validating the push options.

The PostReceive worker invalidates the branch name cache, but does so asynchronously, so we may race with it. Until it is invalidated, the target branch may appear as if it doesn't exist, so we should instead explicitly invalidate it for ourselves.

This is just dead reckoning at the moment, and is unlikely to solve cases where the target branch is the project's default branch, but it seems worth fixing to me.

Screenshots or Screencasts (strongly suggested)

How to setup and validate locally (strongly suggested)

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Related to #273131 (closed)

Edited by Nick Thomas

Merge request reports

Loading