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

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

Constant Summary

Constants inherited from Gitlab::QA::Runtime::OmnibusConfiguration

Gitlab::QA::Runtime::OmnibusConfiguration::ERB_PATTERN

Instance Method Summary collapse

Methods inherited from Default

configuration

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

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

Constructor Details

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

Instance Method Details

#configurationObject



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

def configuration
  Runtime::Env.require_gcs_environment!

  json_key = setup_json_key

  <<~OMNIBUS
    gitlab_rails['object_store']['connection'] = { 'provider' => 'Google', 'google_project' => '$GOOGLE_PROJECT', 'google_client_email' => '$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



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

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

    file
  end
end