diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-05 18:09:05 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-05 18:09:05 +0300 |
commit | 2f229658aea96b45edbb28c97a2aa0c58b3433eb (patch) | |
tree | e4b9d68d4d33ed2a48e8188da7ffb551d24af958 /app/services/deployments | |
parent | 2e32e03fc2aa93d8b6ef8f5b8e0fedc1faaf0ed7 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/deployments')
-rw-r--r-- | app/services/deployments/link_merge_requests_service.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/app/services/deployments/link_merge_requests_service.rb b/app/services/deployments/link_merge_requests_service.rb index eba5082e6c3..0ac572def8f 100644 --- a/app/services/deployments/link_merge_requests_service.rb +++ b/app/services/deployments/link_merge_requests_service.rb @@ -18,6 +18,21 @@ module Deployments # app deployments, as this is not useful. return if deployment.environment.environment_type + # This service is triggered by a Sidekiq worker, which only runs when a + # deployment is successful. We add an extra check here in case we ever + # call this service elsewhere and forget to check the status there. + # + # The reason we only want to link successful deployments is as follows: + # when we link a merge request, we don't link it to future deployments for + # the same environment. If we were to link an MR to a failed deploy, we + # wouldn't be able to later on link it to a successful deploy (e.g. after + # the deploy is retried). + # + # In addition, showing failed deploys in the UI of a merge request isn't + # useful to users, as they can't act upon the information in any + # meaningful way (i.e. they can't just retry the deploy themselves). + return unless deployment.success? + if (prev = deployment.previous_environment_deployment) link_merge_requests_for_range(prev.sha, deployment.sha) else |