Skip to content

Link merge requests for all non review app deploys

Yorick Peterse requested to merge fix-linking-merge-requests into master

What does this MR do?

This changes how we link merge requests to deployments so that:

  1. We link merge requests for any deployment that is not in the "created" state.
  2. We do not link merge requests to review app deployments.

We want to link deployments regardless of their status so that we can also show failed and running deploys in the merge request widget (and perhaps in other places). We don't want to link review app deployments since this is not useful, and may lead to deployments to different review app environments showing up on a merge request page.

This builds on the refactoring of the deployment model introduced in merge request !20474 (merged), and moves the linking of merge requests to Deployments::FinishedWorker. This worker is scheduled every time a deployment transitions to a finished state.

As part of these changes we also change Deployment#link_merge_requests so that it ignores any already linked merge requests. This way if a deployment changes its status multiple times, we don't error with duplicate key errors.

This fixes #38092 (closed), #38000 (closed).

Does this MR meet the acceptance criteria?

Conformity

Edited by Yorick Peterse

Merge request reports