diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-04-13 20:27:29 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-04-13 20:27:29 +0000 |
commit | bdba353a06bc74629cf570f1cbe123cde8524d77 (patch) | |
tree | 3b27a38028112efdeb94107b3b0c76384a06e346 /app/services/ci/retry_job_service.rb | |
parent | c20ce49bdab650656be01968381f6ee1a5f96e7c (diff) | |
download | gitlab-ce-bdba353a06bc74629cf570f1cbe123cde8524d77.tar.gz |
Add latest changes from gitlab-org/gitlab@15-10-stable-ee
Diffstat (limited to 'app/services/ci/retry_job_service.rb')
-rw-r--r-- | app/services/ci/retry_job_service.rb | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/app/services/ci/retry_job_service.rb b/app/services/ci/retry_job_service.rb index da0e80dfed7..e3cbba6de23 100644 --- a/app/services/ci/retry_job_service.rb +++ b/app/services/ci/retry_job_service.rb @@ -19,7 +19,7 @@ module Ci end # rubocop: disable CodeReuse/ActiveRecord - def clone!(job, variables: [], enqueue_if_actionable: false) + def clone!(job, variables: [], enqueue_if_actionable: false, start_pipeline: false) # Cloning a job requires a strict type check to ensure # the attributes being used for the clone are taken straight # from the model and not overridden by other abstractions. @@ -32,7 +32,11 @@ module Ci new_job.set_enqueue_immediately! end + start_pipeline_proc = -> { start_pipeline(job, new_job) } if start_pipeline + new_job.run_after_commit do + start_pipeline_proc&.call + ::Ci::CopyCrossDatabaseAssociationsService.new.execute(job, new_job) ::Deployments::CreateForBuildService.new.execute(new_job) @@ -59,15 +63,12 @@ module Ci def check_assignable_runners!(job); end def retry_job(job, variables: []) - clone!(job, variables: variables, enqueue_if_actionable: true).tap do |new_job| + clone!(job, variables: variables, enqueue_if_actionable: true, start_pipeline: true).tap do |new_job| check_assignable_runners!(new_job) if new_job.is_a?(Ci::Build) next if new_job.failed? ResetSkippedJobsService.new(project, current_user).execute(job) - - Ci::PipelineCreation::StartPipelineService.new(job.pipeline).execute - new_job.reset end end @@ -76,6 +77,11 @@ module Ci raise Gitlab::Access::AccessDeniedError, '403 Forbidden' end end + + def start_pipeline(job, new_job) + Ci::PipelineCreation::StartPipelineService.new(job.pipeline).execute + new_job.reset + end end end |