diff options
Diffstat (limited to 'app/services/ci/retry_build_service.rb')
-rw-r--r-- | app/services/ci/retry_build_service.rb | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/app/services/ci/retry_build_service.rb b/app/services/ci/retry_build_service.rb index 338495ba030..7a5e33c61ba 100644 --- a/app/services/ci/retry_build_service.rb +++ b/app/services/ci/retry_build_service.rb @@ -39,9 +39,18 @@ module Ci .where(name: build.name) .update_all(retried: true) - project.builds.create!(Hash[attributes]) + create_build!(attributes) end end # rubocop: enable CodeReuse/ActiveRecord + + private + + def create_build!(attributes) + build = project.builds.new(Hash[attributes]) + build.deployment = ::Gitlab::Ci::Pipeline::Seed::Deployment.new(build).to_resource + build.save! + build + end end end |