Class: Gitlab::QA::Component::InternetTunnel

Inherits:
Base
  • Object
show all
Defined in:
lib/gitlab/qa/component/internet_tunnel.rb

Constant Summary collapse

DOCKER_IMAGE =
'gitlab/ssh-tunnel'.freeze
DOCKER_IMAGE_TAG =
'1.0.0'.freeze

Instance Attribute Summary collapse

Attributes inherited from Base

#docker, #environment, #network, #runner_network, #volumes

Instance Method Summary collapse

Methods inherited from Base

#add_network_alias, #hostname, #image, #prepare, #prepare_docker_container, #prepare_docker_image, #prepare_network, #process_exec_commands, #pull, #restart, #tag, #teardown!

Methods included from Scenario::Actable

#act, included

Constructor Details

#initializeInternetTunnel

Returns a new instance of InternetTunnel.



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/gitlab/qa/component/internet_tunnel.rb', line 12

def initialize
  super

  key_dir = ENV['CI_PROJECT_DIR'] || Dir.tmpdir
  @ssh_key = Tempfile.new('tunnel-ssh-private-key', key_dir)
  @ssh_key.write(ENV.fetch('TUNNEL_SSH_PRIVATE_KEY'))
  @ssh_key.close

  File.chmod(0o600, @ssh_key.path)

  @volumes['/root/.ssh/id_rsa'] = @ssh_key.path
end

Instance Attribute Details

#gitlab_hostname=(value) ⇒ Object (writeonly)

Sets the attribute gitlab_hostname

Parameters:

  • value

    the value to set the attribute gitlab_hostname to.



10
11
12
# File 'lib/gitlab/qa/component/internet_tunnel.rb', line 10

def gitlab_hostname=(value)
  @gitlab_hostname = value
end

Instance Method Details

#instanceObject



25
26
27
28
29
# File 'lib/gitlab/qa/component/internet_tunnel.rb', line 25

def instance
  raise 'Please provide a block!' unless block_given?

  super
end

#urlObject



31
32
33
# File 'lib/gitlab/qa/component/internet_tunnel.rb', line 31

def url
  "https://#{subdomain}.#{tunnel_server_hostname}"
end