Class: Ci::PlayManualStageService

Inherits:
BaseService show all
Defined in:
app/services/ci/play_manual_stage_service.rb

Instance Attribute Summary

Attributes inherited from BaseService

#params, #project

Instance Method Summary collapse

Methods included from BaseServiceUtility

#deny_visibility_level, #event_service, #log_error, #log_info, #notification_service, #system_hook_service, #todo_service, #visibility_level

Methods included from Gitlab::Allowable

#can?

Constructor Details

#initialize(project, current_user, params) ⇒ PlayManualStageService

Returns a new instance of PlayManualStageService.


5
6
7
8
9
# File 'app/services/ci/play_manual_stage_service.rb', line 5

def initialize(project, current_user, params)
  super

  @pipeline = params[:pipeline]
end

Instance Method Details

#execute(stage) ⇒ Object


11
12
13
14
15
16
17
18
19
# File 'app/services/ci/play_manual_stage_service.rb', line 11

def execute(stage)
  stage.builds.manual.each do |build|
    next unless build.playable?

    build.play(current_user)
  rescue Gitlab::Access::AccessDeniedError
    logger.error(message: 'Unable to play manual action', build_id: build.id)
  end
end