Class: Vidar::Run

Inherits:
Object
  • Object
show all
Defined in:
lib/vidar/run.rb

Class Method Summary collapse

Class Method Details

.docker(command) ⇒ Object



4
5
6
# File 'lib/vidar/run.rb', line 4

def docker(command)
  system("docker #{command}") || exit(1)
end

.docker_compose(command) ⇒ Object



8
9
10
11
# File 'lib/vidar/run.rb', line 8

def docker_compose(command)
  args = %w[revision current_branch].map { |arg| "#{arg.upcase}=#{Config.get!(arg.to_sym)}" }
  system("#{args.join(' ')} #{Config.get!(:compose_cmd)} -f #{Config.get!(:compose_file)} #{command}") || exit(1)
end

.kubectl(command, namespace: Config.get!(:namespace)) ⇒ Object



13
14
15
# File 'lib/vidar/run.rb', line 13

def kubectl(command, namespace: Config.get!(:namespace))
  system("#{kubectl_envs_string}kubectl --namespace=#{namespace} #{command}") || exit(1)
end

.kubectl_capture3(command, namespace: Config.get!(:namespace)) ⇒ Object



17
18
19
# File 'lib/vidar/run.rb', line 17

def kubectl_capture3(command, namespace: Config.get!(:namespace))
  Open3.capture3("#{kubectl_envs_string}kubectl #{command} --namespace=#{namespace}") || exit(1)
end

.kubectl_envs_stringObject



21
22
23
24
# File 'lib/vidar/run.rb', line 21

def kubectl_envs_string
  https_proxy = Config.deploy_config.https_proxy
  "HTTPS_PROXY=#{https_proxy} " if https_proxy
end