Method: Stax::Cmd::Codepipeline#state

Defined in:
lib/stax/mixin/codepipeline.rb

#stateObject



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/stax/mixin/codepipeline.rb', line 78

def state
  my.stack_pipeline_names.each do |name|
    state = Aws::Codepipeline.state(name)
    debug("State for #{name} at #{state.updated}")
    print_table state.stage_states.map { |s|
      s.action_states.map { |a|
        l = a.latest_execution
        percent = (l&.percent_complete || 100).to_s + '%'
        sha = a.current_revision&.revision_id&.slice(0,7)
        ago = (t = l&.last_status_change) ? human_time_diff(Time.now - t, 1) : '?'
        [s.stage_name, a.action_name, color(l&.status || '', COLORS), percent, "#{ago} ago", (sha || l&.token), l&.error_details&.message]
      }
    }.flatten(1)
  end
end