Class: Gitlab::QA::Component::Minio

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

Constant Summary collapse

DOCKER_IMAGE =
'minio/minio'.freeze
DOCKER_IMAGE_TAG =
'latest'.freeze
AWS_ACCESS_KEY =

These are secrets used in a local Minio container, they’re not used for any online S3 server.

'AKIAIOSFODNN7EXAMPLE'.freeze
AWS_SECRET_KEY =
'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY'.freeze
DATA_DIR =
'/data'.freeze
DEFAULT_PORT =
9000

Instance Attribute Summary

Attributes inherited from Base

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

Instance Method Summary collapse

Methods inherited from Base

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

Methods included from Scenario::Actable

#act, included

Constructor Details

#initializeMinio

Returns a new instance of Minio.



18
19
20
21
22
23
24
# File 'lib/gitlab/qa/component/minio.rb', line 18

def initialize
  super

  @environment = { MINIO_ACCESS_KEY: AWS_ACCESS_KEY, MINIO_SECRET_KEY: AWS_SECRET_KEY }
  @volumes = { host_data_dir => DATA_DIR }
  @buckets = []
end

Instance Method Details

#add_bucket(name) ⇒ Object



32
33
34
# File 'lib/gitlab/qa/component/minio.rb', line 32

def add_bucket(name)
  @buckets << name
end

#instanceObject



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

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

  super
end

#to_configObject



36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/gitlab/qa/component/minio.rb', line 36

def to_config
  config = YAML.safe_load <<~CFG
    provider: AWS
    aws_access_key_id: #{AWS_ACCESS_KEY}
    aws_secret_access_key: #{AWS_SECRET_KEY}
    aws_signature_version: 4
    host: #{hostname}
    endpoint: http://#{hostname}:#{port}
    path_style: true
  CFG

  # Quotes get eaten up when the string is set in the environment
  config.to_s.gsub('"', '\\"')
end