Class: Ci::BuildRunnerSession
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- ApplicationRecord
- Ci::BuildRunnerSession
- Includes:
- Partitionable
- Defined in:
- app/models/ci/build_runner_session.rb
Overview
The purpose of this class is to store Build related runner session. Data will be removed after transitioning from running to any state.
Constant Summary collapse
- TERMINAL_SUBPROTOCOL =
'terminal.gitlab.com'
- DEFAULT_SERVICE_NAME =
'build'
- DEFAULT_PORT_NAME =
'default_port'
Constants inherited from ApplicationRecord
Constants included from HasCheckConstraints
HasCheckConstraints::NOT_NULL_CHECK_PATTERN
Constants included from ResetOnColumnErrors
ResetOnColumnErrors::MAX_RESET_PERIOD
Instance Method Summary collapse
- #service_specification(service: nil, path: nil, port: nil, subprotocols: nil) ⇒ Object
- #terminal_specification ⇒ Object
Methods included from Partitionable
Methods inherited from ApplicationRecord
Methods inherited from ApplicationRecord
===, cached_column_list, #create_or_load_association, declarative_enum, default_select_columns, id_in, id_not_in, iid_in, nullable_column?, pluck_primary_key, primary_key_in, #readable_by?, safe_ensure_unique, safe_find_or_create_by, safe_find_or_create_by!, #to_ability_name, underscore, where_exists, where_not_exists, with_fast_read_statement_timeout, without_order
Methods included from ResetOnColumnErrors
#reset_on_union_error, #reset_on_unknown_attribute_error
Methods included from Gitlab::SensitiveSerializableHash
Instance Method Details
#service_specification(service: nil, path: nil, port: nil, subprotocols: nil) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 |
# File 'app/models/ci/build_runner_session.rb', line 35 def service_specification(service: nil, path: nil, port: nil, subprotocols: nil) return {} unless url.present? port = port.presence || DEFAULT_PORT_NAME service = service.presence || DEFAULT_SERVICE_NAME parsed_url = URI.parse(Addressable::URI.escape(url)) parsed_url.path += "/proxy/#{service}/#{port}/#{path}" subprotocols = subprotocols.presence || ::Ci::BuildRunnerSession::TERMINAL_SUBPROTOCOL channel_specification(parsed_url, subprotocols) end |
#terminal_specification ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'app/models/ci/build_runner_session.rb', line 26 def terminal_specification wss_url = Gitlab::UrlHelpers.as_wss(Addressable::URI.escape(url)) return {} unless wss_url.present? parsed_wss_url = URI.parse(wss_url) parsed_wss_url.path += '/exec' channel_specification(parsed_wss_url, TERMINAL_SUBPROTOCOL) end |