Class: Ci::CreateWebIdeTerminalService

Inherits:
BaseService show all
Includes:
Gitlab::Utils::StrongMemoize
Defined in:
app/services/ci/create_web_ide_terminal_service.rb

Constant Summary collapse

TerminalCreationError =
Class.new(StandardError)
TERMINAL_NAME =
'terminal'.freeze

Instance Attribute Summary collapse

Attributes inherited from BaseService

#current_user, #params, #project

Instance Method Summary collapse

Methods included from Gitlab::Utils::StrongMemoize

#clear_memoization, #strong_memoize, #strong_memoized?

Methods inherited from BaseService

#initialize

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

This class inherits a constructor from BaseService

Instance Attribute Details

#terminalObject (readonly)

Returns the value of attribute terminal


11
12
13
# File 'app/services/ci/create_web_ide_terminal_service.rb', line 11

def terminal
  @terminal
end

Instance Method Details

#executeObject


13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/services/ci/create_web_ide_terminal_service.rb', line 13

def execute
  check_access!
  validate_params!
  load_terminal_config!

  pipeline = create_pipeline!
  success(pipeline: pipeline)
rescue TerminalCreationError => e
  error(e.message)
rescue ActiveRecord::RecordInvalid => e
  error("Failed to persist the pipeline: #{e.message}")
end