diff options
author | Sean McGivern <sean@gitlab.com> | 2017-10-13 16:26:17 +0100 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2017-10-16 11:10:07 +0100 |
commit | 6247886405b5f15e05750049254f2d341b9de72d (patch) | |
tree | 5c816a506d88e0fc9e56796e5a66bed5b124a8f2 /app | |
parent | 5e0fca33220708e16f3862aa93b49fade8d719a5 (diff) | |
download | gitlab-ce-6247886405b5f15e05750049254f2d341b9de72d.tar.gz |
Don't create build failed todo when build is retried38236-remove-build-failed-todo-if-it-has-been-auto-retried
When a build is retried automatically, we close any open todos. However, we do
that _before_ creating a new build failed todo.
To solve this, we check if the build is retried before creating the todo. We
also ensure that the build _instance_ has the correct attribute set, without
needing to reload it from the database.
Diffstat (limited to 'app')
-rw-r--r-- | app/services/ci/retry_build_service.rb | 2 | ||||
-rw-r--r-- | app/services/merge_requests/add_todo_when_build_fails_service.rb | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/app/services/ci/retry_build_service.rb b/app/services/ci/retry_build_service.rb index d67b9f5cc56..c552193e66b 100644 --- a/app/services/ci/retry_build_service.rb +++ b/app/services/ci/retry_build_service.rb @@ -28,6 +28,8 @@ module Ci attributes.push([:user, current_user]) + build.retried = true + Ci::Build.transaction do # mark all other builds of that name as retried build.pipeline.builds.latest diff --git a/app/services/merge_requests/add_todo_when_build_fails_service.rb b/app/services/merge_requests/add_todo_when_build_fails_service.rb index 727768b1a39..6805b2f7d1c 100644 --- a/app/services/merge_requests/add_todo_when_build_fails_service.rb +++ b/app/services/merge_requests/add_todo_when_build_fails_service.rb @@ -3,7 +3,7 @@ module MergeRequests # Adds a todo to the parent merge_request when a CI build fails # def execute(commit_status) - return if commit_status.allow_failure? + return if commit_status.allow_failure? || commit_status.retried? commit_status_merge_requests(commit_status) do |merge_request| todo_service.merge_request_build_failed(merge_request) |