Sha256: 39e53c6017c4a2c75bc95e9766177951fe417c232fee31ba6b8492d58458de3e

Contents?: true

Size: 967 Bytes

Versions: 2

Compression:

Stored size: 967 Bytes

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true

require 'open3'
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), "..", "lib")
require 'helm_upgrade_logs'

$release_name = ARGV.find { |arg| !arg.start_with?('-') }

helm_pid = Process.spawn "helm upgrade #{ARGV.join(' ')}"

event_pid = Process.spawn 'kubectl get events --watch-only=true'
service_pid = Process.spawn 'kubectl get services --watch-only=true'

wait_for_pod_to_log

@pods = []

while Process.waitpid(helm_pid, Process::WNOHANG) == nil do
  pods = get_pods
  if pods != @pods
    @pods = pods
    puts "[INFO] Pods: #{pods.join(',')}"
    puts `kill #{@log_pid}` if @log_pid
    @log_pid = Process.spawn "kubectl logs -lapp.kubernetes.io/managed-by=Helm,app.kubernetes.io/instance=#{$release_name} -f --all-containers --prefix --ignore-errors=true --max-log-requests=20 --timestamps=true --since=0s"
  end
  sleep 2.5
end
puts `kill #{@log_pid}`
puts `kill #{event_pid}`
puts `kill #{service_pid}`

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
helm_upgrade_logs-0.2.0 exe/helm_upgrade_logs
helm_upgrade_logs-0.1.7 exe/helm_upgrade_logs