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 =
'RELEASE.2021-09-15T04-54-25Z'.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, #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.



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

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



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

def add_bucket(name)
  @buckets << name
end

#to_configObject



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

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