debian-mirror-gitlab/app/models/ci/build_runner_session.rb

28 lines
795 B
Ruby
Raw Normal View History

2018-11-18 11:00:15 +05:30
# frozen_string_literal: true
2018-11-08 19:23:39 +05:30
module Ci
# The purpose of this class is to store Build related runner session.
# Data will be removed after transitioning from running to any state.
2019-05-30 16:15:17 +05:30
class BuildRunnerSession < ActiveRecord::Base
2018-11-08 19:23:39 +05:30
extend Gitlab::Ci::Model
self.table_name = 'ci_builds_runner_session'
belongs_to :build, class_name: 'Ci::Build', inverse_of: :runner_session
validates :build, presence: true
validates :url, url: { protocols: %w(https) }
def terminal_specification
2019-05-30 16:15:17 +05:30
return {} unless url.present?
2018-11-08 19:23:39 +05:30
{
2019-05-30 16:15:17 +05:30
subprotocols: ['terminal.gitlab.com'].freeze,
url: "#{url}/exec".sub("https://", "wss://"),
2018-11-18 11:00:15 +05:30
headers: { Authorization: [authorization.presence] }.compact,
2018-11-08 19:23:39 +05:30
ca_pem: certificate.presence
}
end
end
end