Class: Gitlab::QA::Docker::Volumes

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/qa/docker/volumes.rb

Constant Summary collapse

VOLUMES =
{ 'config' => '/etc/gitlab',
'data' => '/var/opt/gitlab' }.freeze
QA_CONTAINER_WORKDIR =
'/home/gitlab/qa'

Instance Method Summary collapse

Constructor Details

#initialize(volumes = VOLUMES) ⇒ Volumes

Returns a new instance of Volumes.



14
15
16
# File 'lib/gitlab/qa/docker/volumes.rb', line 14

def initialize(volumes = VOLUMES)
  @volumes = volumes
end

Instance Method Details

#with_temporary_volumesObject



18
19
20
21
22
23
24
25
# File 'lib/gitlab/qa/docker/volumes.rb', line 18

def with_temporary_volumes
  # macOS's tmpdir is a symlink /var/folders -> /private/var/folders
  # but Docker on macOS exposes /private and disallow exposing /var/
  # so we need to get the real tmpdir path
  Dir.mktmpdir('gitlab-qa-', File.realpath(Dir.tmpdir)).tap do |dir|
    yield @volumes.transform_keys { |k| "#{dir}/#{k}" }
  end
end