Sha256: 8eb3a69676f6787aa507cdfba079cdf41ffd54e54f3d717b1757ce43b11e1a93

Contents?: true

Size: 1.73 KB

Versions: 18

Compression:

Stored size: 1.73 KB

Contents

# frozen_string_literal: true

require 'tempfile'

module Gitlab
  module QA
    module Runtime
      module OmnibusConfigurations
        class ObjectStorageGcs < Default
          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

          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
        end
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
gitlab-qa-14.2.0 lib/gitlab/qa/runtime/omnibus_configurations/object_storage_gcs.rb
gitlab-qa-14.1.0 lib/gitlab/qa/runtime/omnibus_configurations/object_storage_gcs.rb
gitlab-qa-14.0.2 lib/gitlab/qa/runtime/omnibus_configurations/object_storage_gcs.rb
gitlab-qa-14.0.1 lib/gitlab/qa/runtime/omnibus_configurations/object_storage_gcs.rb
gitlab-qa-14.0.0 lib/gitlab/qa/runtime/omnibus_configurations/object_storage_gcs.rb
gitlab-qa-13.2.1 lib/gitlab/qa/runtime/omnibus_configurations/object_storage_gcs.rb
gitlab-qa-13.2.0 lib/gitlab/qa/runtime/omnibus_configurations/object_storage_gcs.rb
gitlab-qa-13.1.0 lib/gitlab/qa/runtime/omnibus_configurations/object_storage_gcs.rb
gitlab-qa-13.0.0 lib/gitlab/qa/runtime/omnibus_configurations/object_storage_gcs.rb
gitlab-qa-12.5.1 lib/gitlab/qa/runtime/omnibus_configurations/object_storage_gcs.rb
gitlab-qa-12.5.0 lib/gitlab/qa/runtime/omnibus_configurations/object_storage_gcs.rb
gitlab-qa-12.4.1 lib/gitlab/qa/runtime/omnibus_configurations/object_storage_gcs.rb
gitlab-qa-12.4.0 lib/gitlab/qa/runtime/omnibus_configurations/object_storage_gcs.rb
gitlab-qa-12.3.0 lib/gitlab/qa/runtime/omnibus_configurations/object_storage_gcs.rb
gitlab-qa-12.2.1 lib/gitlab/qa/runtime/omnibus_configurations/object_storage_gcs.rb
gitlab-qa-12.2.0 lib/gitlab/qa/runtime/omnibus_configurations/object_storage_gcs.rb
gitlab-qa-12.1.0 lib/gitlab/qa/runtime/omnibus_configurations/object_storage_gcs.rb
gitlab-qa-12.0.0 lib/gitlab/qa/runtime/omnibus_configurations/object_storage_gcs.rb