Commit 9dd5444f authored by Kamil Trzciński's avatar Kamil Trzciński

Merge branch '323062-unifying-job-retries-v1' into 'master'

Refactor RetryBuildService with the new method

See merge request gitlab-org/gitlab!62453
parents d4d77888 66e5c3aa
......@@ -34,15 +34,9 @@ module Ci
attributes[:user] = current_user
Ci::Build.transaction do
# mark all other builds of that name as retried
build.pipeline.builds.latest
.where(name: build.name)
.update_all(retried: true, processed: true)
create_build!(attributes).tap do
# mark existing object as retried/processed without a reload
build.retried = true
build.processed = true
create_build!(attributes).tap do |new_build|
new_build.update_older_statuses_retried!
build.reset # refresh the data to get new values of `retried` and `processed`.
end
end
end
......@@ -59,7 +53,6 @@ module Ci
def create_build!(attributes)
build = project.builds.new(attributes)
build.assign_attributes(::Gitlab::Ci::Pipeline::Seed::Build.environment_attributes_for(build))
build.retried = false
BulkInsertableAssociations.with_bulk_insert do
build.save!
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment