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_hash, "kubectl", "-n", namespace, *command.split) || 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_hash, "kubectl", "-n", namespace, *command.split) || exit(1)
end

.kubectl_envs_hashObject



26
27
28
# File 'lib/vidar/run.rb', line 26

def kubectl_envs_hash
  {"HTTPS_PROXY" => Config.deploy_config.https_proxy}.compact
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=#{https_proxy} " : ""
end