diff --git a/lib/stax/mixin/codepipeline.rb b/lib/stax/mixin/codepipeline.rb index 9c9c82e..fbb8865 100644 --- a/lib/stax/mixin/codepipeline.rb +++ b/lib/stax/mixin/codepipeline.rb @@ -111,6 +111,7 @@ def tail(name = nil) name ||= my.stack_pipeline_names.first last_seen = nil loop do + sleep 5 state = Aws::Codepipeline.state(name) now = Time.now stages = state.stage_states.map do |s| @@ -120,7 +121,14 @@ def tail(name = nil) [s.stage_name, color(s&.latest_execution&.status || '', COLORS), "#{ago} ago", revisions].join(' ') end puts [set_color(now, :blue), stages].flatten.join(' ') - sleep 5 + if stages.none? { |stage| stage.match? /InProgress/ } + if stages.all? { |stage| stage.match? /Succeeded/ } + puts set_color("All stages succeeded!", :green) + else + puts set_color("Pipeline did not complete successfully.", :red) + end + break + end end end