class Gitlab::QA::Docker::Command

def self.execute(cmd, mask_secrets: nil, &block)

def self.execute(cmd, mask_secrets: nil, &block)
  new(cmd, mask_secrets: mask_secrets).execute!(&block)
end

def <<(*args)

def <<(*args)
  tap { @args.concat(args) }
end

def ==(other)

def ==(other)
  to_s == other.to_s
end

def env(name, value)

def env(name, value)
  tap { @args.push(%(--env #{name}="#{value}")) }
end

def execute!(&block)

def execute!(&block)
  Support::ShellCommand.new(to_s, mask_secrets: @mask_secrets, stream_output: @stream_output).execute!(&block)
rescue Support::ShellCommand::StatusError => e
  e.set_backtrace([])
  raise e
end

def initialize(cmd = nil, mask_secrets: nil, stream_output: false)

Parameters:
  • stream_output (Boolean) -- stream command output to stdout directly instead of logger
  • mask_secrets () --
  • cmd () --
def initialize(cmd = nil, mask_secrets: nil, stream_output: false)
  @args = Array(cmd)
  @mask_secrets = Array(mask_secrets)
  @stream_output = stream_output
end

def name(identity)

def name(identity)
  tap { @args.push("--name #{identity}") }
end

def port(mapping)

def port(mapping)
  tap { @args.push("-p #{mapping}") }
end

def to_s

def to_s
  "docker #{@args.join(' ')}"
end

def volume(from, to, opt = :z)

def volume(from, to, opt = :z)
  tap { @args.push("--volume #{from}:#{to}:#{opt}") }
end