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 ...@@ -34,15 +34,9 @@ module Ci
attributes[:user] = current_user attributes[:user] = current_user
Ci::Build.transaction do Ci::Build.transaction do
# mark all other builds of that name as retried create_build!(attributes).tap do |new_build|
build.pipeline.builds.latest new_build.update_older_statuses_retried!
.where(name: build.name) build.reset # refresh the data to get new values of `retried` and `processed`.
.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
end end
end end
end end
...@@ -59,7 +53,6 @@ module Ci ...@@ -59,7 +53,6 @@ module Ci
def create_build!(attributes) def create_build!(attributes)
build = project.builds.new(attributes) build = project.builds.new(attributes)
build.assign_attributes(::Gitlab::Ci::Pipeline::Seed::Build.environment_attributes_for(build)) build.assign_attributes(::Gitlab::Ci::Pipeline::Seed::Build.environment_attributes_for(build))
build.retried = false
BulkInsertableAssociations.with_bulk_insert do BulkInsertableAssociations.with_bulk_insert do
build.save! build.save!
end 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