148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
|
# File 'lib/stax/mixin/codepipeline.rb', line 148
def tail(name = nil)
trap('SIGINT', 'EXIT')
name ||= my.stack_pipeline_names.first
last_seen = nil
loop do
state = Aws::Codepipeline.state(name)
now = Time.now
stages = state.stage_states.map do |s|
last_change = s.action_states.map { |a| a&.latest_execution&.last_status_change }.compact.max
revisions = s.action_states.map { |a| a.current_revision&.revision_id&.slice(0,7) }.join(' ')
ago = last_change ? human_time_diff(now - last_change, 1) : '?'
[s.stage_name, color(s&.latest_execution&.status || '', COLORS), "#{ago} ago", revisions].join(' ')
end
puts [set_color(now, :blue), stages].flatten.join(' ')
sleep 5
end
end
|