Sha256: d2d949e59435373ced8be8c311f07dae0948fd0df224726552f49fe189ef92c2

Contents?: true

Size: 913 Bytes

Versions: 5

Compression:

Stored size: 913 Bytes

Contents

module Vidar
  class Run
    class << self
      def docker(command)
        system("docker #{command}") || exit(1)
      end

      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

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

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

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
vidar-1.14.0 lib/vidar/run.rb
vidar-1.13.4 lib/vidar/run.rb
vidar-1.13.3 lib/vidar/run.rb
vidar-1.13.2 lib/vidar/run.rb
vidar-1.13.1 lib/vidar/run.rb