summaryrefslogtreecommitdiff
path: root/app/services/ci/retry_pipeline_service.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-12-06 18:07:44 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-12-06 18:07:44 +0000
commite1867c38fc5a4b931b4b2256d4909182e94f1051 (patch)
tree3047b637f7f9a31e74c62d3fe054b24c95e3534e /app/services/ci/retry_pipeline_service.rb
parent63894d59abd34f76f399d755012cdcd32c5b1103 (diff)
downloadgitlab-ce-e1867c38fc5a4b931b4b2256d4909182e94f1051.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/ci/retry_pipeline_service.rb')
-rw-r--r--app/services/ci/retry_pipeline_service.rb14
1 files changed, 12 insertions, 2 deletions
diff --git a/app/services/ci/retry_pipeline_service.rb b/app/services/ci/retry_pipeline_service.rb
index 1f747aac98f..7d01de9ee68 100644
--- a/app/services/ci/retry_pipeline_service.rb
+++ b/app/services/ci/retry_pipeline_service.rb
@@ -9,13 +9,23 @@ module Ci
raise Gitlab::Access::AccessDeniedError
end
- pipeline.retryable_builds.find_each do |build|
+ needs = Set.new
+
+ pipeline.retryable_builds.preload_needs.find_each do |build|
next unless can?(current_user, :update_build, build)
Ci::RetryBuildService.new(project, current_user)
.reprocess!(build)
+
+ needs += build.needs.map(&:name)
end
+ # In a DAG, the dependencies may have already completed. Figure out
+ # which builds have succeeded and use them to update the pipeline. If we don't
+ # do this, then builds will be stuck in the created state since their dependencies
+ # will never run.
+ completed_build_ids = pipeline.find_successful_build_ids_by_names(needs) if needs.any?
+
pipeline.builds.latest.skipped.find_each do |skipped|
retry_optimistic_lock(skipped) { |build| build.process }
end
@@ -26,7 +36,7 @@ module Ci
Ci::ProcessPipelineService
.new(pipeline)
- .execute
+ .execute(completed_build_ids)
end
end
end