diff options
Diffstat (limited to 'app/services/ci/process_pipeline_service.rb')
-rw-r--r-- | app/services/ci/process_pipeline_service.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/app/services/ci/process_pipeline_service.rb b/app/services/ci/process_pipeline_service.rb index cafee76a33c..69341a6c263 100644 --- a/app/services/ci/process_pipeline_service.rb +++ b/app/services/ci/process_pipeline_service.rb @@ -60,17 +60,23 @@ module Ci end end + # rubocop: disable CodeReuse/ActiveRecord def status_for_prior_stages(index) pipeline.builds.where('stage_idx < ?', index).latest.status || 'success' end + # rubocop: enable CodeReuse/ActiveRecord + # rubocop: disable CodeReuse/ActiveRecord def stage_indexes_of_created_builds created_builds.order(:stage_idx).pluck('distinct stage_idx') end + # rubocop: enable CodeReuse/ActiveRecord + # rubocop: disable CodeReuse/ActiveRecord def created_builds_in_stage(index) created_builds.where(stage_idx: index) end + # rubocop: enable CodeReuse/ActiveRecord def created_builds pipeline.builds.created @@ -80,6 +86,7 @@ module Ci # This replicates what is db/post_migrate/20170416103934_upate_retried_for_ci_build.rb # and ensures that functionality will not be broken before migration is run # this updates only when there are data that needs to be updated, there are two groups with no retried flag + # rubocop: disable CodeReuse/ActiveRecord def update_retried # find the latest builds for each name latest_statuses = pipeline.statuses.latest @@ -93,6 +100,7 @@ module Ci .where.not(id: latest_statuses.map(&:first)) .update_all(retried: true) if latest_statuses.any? end + # rubocop: enable CodeReuse/ActiveRecord def enqueue_build(build) Ci::EnqueueBuildService.new(project, @user).execute(build) |