Class: Mrsk::Configuration::Builder

Inherits:
Object
  • Object
show all
Defined in:
lib/mrsk/configuration/builder.rb

Instance Method Summary collapse

Constructor Details

#initialize(config:) ⇒ Builder

Returns a new instance of Builder.



2
3
4
5
6
7
8
# File 'lib/mrsk/configuration/builder.rb', line 2

def initialize(config:)
  @options = config.raw_config.builder || {}
  @image = config.image
  @server = config.registry["server"]

  valid?
end

Instance Method Details

#argsObject



30
31
32
# File 'lib/mrsk/configuration/builder.rb', line 30

def args
  @options["args"] || {}
end

#cache_fromObject



62
63
64
65
66
67
68
69
70
71
# File 'lib/mrsk/configuration/builder.rb', line 62

def cache_from
  if cached?
    case @options["cache"]["type"]
    when "gha"
      cache_from_config_for_gha
    when "registry"
      cache_from_config_for_registry
    end
  end
end

#cache_toObject



73
74
75
76
77
78
79
80
81
82
# File 'lib/mrsk/configuration/builder.rb', line 73

def cache_to
  if cached?
    case @options["cache"]["type"]
    when "gha"
      cache_to_config_for_gha
    when "registry"
      cache_to_config_for_registry
    end
  end
end

#cached?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/mrsk/configuration/builder.rb', line 26

def cached?
  !!@options["cache"]
end

#contextObject



42
43
44
# File 'lib/mrsk/configuration/builder.rb', line 42

def context
  @options["context"] || "."
end

#dockerfileObject



38
39
40
# File 'lib/mrsk/configuration/builder.rb', line 38

def dockerfile
  @options["dockerfile"] || "Dockerfile"
end

#local?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/mrsk/configuration/builder.rb', line 18

def local?
  !!@options["local"]
end

#local_archObject



46
47
48
# File 'lib/mrsk/configuration/builder.rb', line 46

def local_arch
  @options["local"]["arch"] if local?
end

#local_hostObject



50
51
52
# File 'lib/mrsk/configuration/builder.rb', line 50

def local_host
  @options["local"]["host"] if local?
end

#multiarch?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/mrsk/configuration/builder.rb', line 14

def multiarch?
  @options["multiarch"] != false
end

#remote?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/mrsk/configuration/builder.rb', line 22

def remote?
  !!@options["remote"]
end

#remote_archObject



54
55
56
# File 'lib/mrsk/configuration/builder.rb', line 54

def remote_arch
  @options["remote"]["arch"] if remote?
end

#remote_hostObject



58
59
60
# File 'lib/mrsk/configuration/builder.rb', line 58

def remote_host
  @options["remote"]["host"] if remote?
end

#secretsObject



34
35
36
# File 'lib/mrsk/configuration/builder.rb', line 34

def secrets
  @options["secrets"] || []
end

#to_hObject



10
11
12
# File 'lib/mrsk/configuration/builder.rb', line 10

def to_h
  @options
end