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'
DOCKER_IMAGE_TAG =
'latest'
AWS_ACCESS_KEY =

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

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

Instance Attribute Summary

Attributes inherited from Base

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

Instance Method Summary collapse

Methods inherited from Base

#add_network_alias, #hostname, #image, #instance, #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.



21
22
23
24
25
26
27
# File 'lib/gitlab/qa/component/minio.rb', line 21

def initialize
  super

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

Instance Method Details

#add_bucket(name) ⇒ Object



29
30
31
# File 'lib/gitlab/qa/component/minio.rb', line 29

def add_bucket(name)
  @buckets << name
end

#to_configObject



33
34
35
36
37
38
39
40
41
42
43
# File 'lib/gitlab/qa/component/minio.rb', line 33

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