diff options
Diffstat (limited to 'app/services/ci')
-rw-r--r-- | app/services/ci/create_pipeline_builds_service.rb | 4 | ||||
-rw-r--r-- | app/services/ci/create_pipeline_service.rb | 6 | ||||
-rw-r--r-- | app/services/ci/create_trigger_request_service.rb | 4 | ||||
-rw-r--r-- | app/services/ci/process_pipeline_service.rb | 6 | ||||
-rw-r--r-- | app/services/ci/register_build_service.rb | 14 | ||||
-rw-r--r-- | app/services/ci/retry_build_service.rb | 10 | ||||
-rw-r--r-- | app/services/ci/retry_pipeline_service.rb | 10 |
7 files changed, 27 insertions, 27 deletions
diff --git a/app/services/ci/create_pipeline_builds_service.rb b/app/services/ci/create_pipeline_builds_service.rb index b7da3f8e7eb..c5da757c840 100644 --- a/app/services/ci/create_pipeline_builds_service.rb +++ b/app/services/ci/create_pipeline_builds_service.rb @@ -36,8 +36,8 @@ module Ci end def new_builds - @new_builds ||= pipeline.config_builds_attributes. - reject { |build| existing_build_names.include?(build[:name]) } + @new_builds ||= pipeline.config_builds_attributes + .reject { |build| existing_build_names.include?(build[:name]) } end def existing_build_names diff --git a/app/services/ci/create_pipeline_service.rb b/app/services/ci/create_pipeline_service.rb index b53a467655f..38a85e9fc42 100644 --- a/app/services/ci/create_pipeline_service.rb +++ b/app/services/ci/create_pipeline_service.rb @@ -48,9 +48,9 @@ module Ci Ci::Pipeline.transaction do pipeline.save - Ci::CreatePipelineBuildsService. - new(project, current_user). - execute(pipeline) + Ci::CreatePipelineBuildsService + .new(project, current_user) + .execute(pipeline) end pipeline.tap(&:process!) diff --git a/app/services/ci/create_trigger_request_service.rb b/app/services/ci/create_trigger_request_service.rb index 6af3c1ca5b1..062e7be5be8 100644 --- a/app/services/ci/create_trigger_request_service.rb +++ b/app/services/ci/create_trigger_request_service.rb @@ -3,8 +3,8 @@ module Ci def execute(project, trigger, ref, variables = nil) trigger_request = trigger.trigger_requests.create(variables: variables) - pipeline = Ci::CreatePipelineService.new(project, nil, ref: ref). - execute(ignore_skip_ci: true, trigger_request: trigger_request) + pipeline = Ci::CreatePipelineService.new(project, nil, ref: ref) + .execute(ignore_skip_ci: true, trigger_request: trigger_request) if pipeline.persisted? trigger_request end diff --git a/app/services/ci/process_pipeline_service.rb b/app/services/ci/process_pipeline_service.rb index 442230abe29..79eb97b7b55 100644 --- a/app/services/ci/process_pipeline_service.rb +++ b/app/services/ci/process_pipeline_service.rb @@ -78,9 +78,9 @@ module Ci def ensure_created_builds! return if created_builds.any? - Ci::CreatePipelineBuildsService. - new(project, current_user). - execute(pipeline) + Ci::CreatePipelineBuildsService + .new(project, current_user) + .execute(pipeline) end end end diff --git a/app/services/ci/register_build_service.rb b/app/services/ci/register_build_service.rb index 6f03bf2be13..9c7abf97b4c 100644 --- a/app/services/ci/register_build_service.rb +++ b/app/services/ci/register_build_service.rb @@ -42,15 +42,15 @@ module Ci def builds_for_shared_runner new_builds. # don't run projects which have not enabled shared runners and builds - joins(:project).where(projects: { shared_runners_enabled: true }). - joins('LEFT JOIN project_features ON ci_builds.gl_project_id = project_features.project_id'). - where('project_features.builds_access_level IS NULL or project_features.builds_access_level > 0'). + joins(:project).where(projects: { shared_runners_enabled: true }) + .joins('LEFT JOIN project_features ON ci_builds.gl_project_id = project_features.project_id') + .where('project_features.builds_access_level IS NULL or project_features.builds_access_level > 0'). # Implement fair scheduling # this returns builds that are ordered by number of running builds # we prefer projects that don't use shared runners at all - joins("LEFT JOIN (#{running_builds_for_shared_runners.to_sql}) AS project_builds ON ci_builds.gl_project_id=project_builds.gl_project_id"). - order('COALESCE(project_builds.running_builds, 0) ASC', 'ci_builds.id ASC') + joins("LEFT JOIN (#{running_builds_for_shared_runners.to_sql}) AS project_builds ON ci_builds.gl_project_id=project_builds.gl_project_id") + .order('COALESCE(project_builds.running_builds, 0) ASC', 'ci_builds.id ASC') end def builds_for_specific_runner @@ -58,8 +58,8 @@ module Ci end def running_builds_for_shared_runners - Ci::Build.running.where(runner: Ci::Runner.shared). - group(:gl_project_id).select(:gl_project_id, 'count(*) AS running_builds') + Ci::Build.running.where(runner: Ci::Runner.shared) + .group(:gl_project_id).select(:gl_project_id, 'count(*) AS running_builds') end def new_builds diff --git a/app/services/ci/retry_build_service.rb b/app/services/ci/retry_build_service.rb index c1fa9278f0f..38ef323f6e5 100644 --- a/app/services/ci/retry_build_service.rb +++ b/app/services/ci/retry_build_service.rb @@ -2,8 +2,8 @@ module Ci class RetryBuildService < ::BaseService CLONE_ATTRIBUTES = %i[pipeline project ref tag options commands name allow_failure stage stage_idx trigger_request - yaml_variables when environment coverage_regex]. - freeze + yaml_variables when environment coverage_regex] + .freeze REJECT_ATTRIBUTES = %i[id status user token coverage trace runner artifacts_expire_at artifacts_file @@ -20,9 +20,9 @@ module Ci new_build.enqueue! - MergeRequests::AddTodoWhenBuildFailsService. - new(project, current_user). - close(new_build) + MergeRequests::AddTodoWhenBuildFailsService + .new(project, current_user) + .close(new_build) end end diff --git a/app/services/ci/retry_pipeline_service.rb b/app/services/ci/retry_pipeline_service.rb index 6e9781ca8cf..2c5e130e5aa 100644 --- a/app/services/ci/retry_pipeline_service.rb +++ b/app/services/ci/retry_pipeline_service.rb @@ -8,13 +8,13 @@ module Ci pipeline.builds.failed_or_canceled.find_each do |build| next unless build.retryable? - Ci::RetryBuildService.new(project, current_user). - reprocess(build) + Ci::RetryBuildService.new(project, current_user) + .reprocess(build) end - MergeRequests::AddTodoWhenBuildFailsService. - new(project, current_user). - close_all(pipeline) + MergeRequests::AddTodoWhenBuildFailsService + .new(project, current_user) + .close_all(pipeline) pipeline.process! end |