Class: Gitlab::QA::Runtime::OmnibusConfigurations::ObjectStorageGcs

Inherits:
Default show all
Defined in:
lib/gitlab/qa/runtime/omnibus_configurations/object_storage_gcs.rb

Instance Method Summary collapse

Methods inherited from Default

configuration

Methods inherited from Gitlab::QA::Runtime::OmnibusConfiguration

#<<, #exec_commands, #initialize, #prepare, #sanitize!, #to_s

Constructor Details

This class inherits a constructor from Gitlab::QA::Runtime::OmnibusConfiguration

Instance Method Details

#configurationObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/gitlab/qa/runtime/omnibus_configurations/object_storage_gcs.rb', line 9

def configuration
  Runtime::Env.require_gcs_environment!

  json_key = setup_json_key

  <<~OMNIBUS
    gitlab_rails['object_store']['connection'] = { 'provider' => 'Google', 'google_project' => '#{Runtime::Env.google_project}', 'google_client_email' => '#{Runtime::Env.google_client_email}', 'google_json_key_location' => '#{json_key.path}' }

    gitlab_rails['object_store']['objects']['artifacts']['bucket'] = '#{Runtime::Env.gcs_bucket_name}'
    gitlab_rails['object_store']['objects']['external_diffs']['bucket'] = '#{Runtime::Env.gcs_bucket_name}'
    gitlab_rails['object_store']['objects']['lfs']['bucket'] = '#{Runtime::Env.gcs_bucket_name}'
    gitlab_rails['object_store']['objects']['uploads']['bucket'] = '#{Runtime::Env.gcs_bucket_name}'
    gitlab_rails['object_store']['objects']['packages']['bucket'] = '#{Runtime::Env.gcs_bucket_name}'
    gitlab_rails['object_store']['objects']['dependency_proxy']['bucket'] = '#{Runtime::Env.gcs_bucket_name}'
    gitlab_rails['object_store']['objects']['pages']['bucket'] = '#{Runtime::Env.gcs_bucket_name}'
    gitlab_rails['object_store']['objects']['terraform_state']['bucket'] = '#{Runtime::Env.gcs_bucket_name}'
  OMNIBUS
end

#setup_json_keyObject



28
29
30
31
32
33
34
# File 'lib/gitlab/qa/runtime/omnibus_configurations/object_storage_gcs.rb', line 28

def setup_json_key
  Tempfile.open('gcs-json-key', ENV['CI_PROJECT_DIR']) do |file|
    file.write(ENV.fetch('GOOGLE_JSON_KEY'))

    file
  end
end