lib/dri/commands/fetch/failures.rb in dri-0.1.0 vs lib/dri/commands/fetch/failures.rb in dri-0.1.1

- old
+ new

@@ -20,10 +20,11 @@ triaged = add_color('Triaged?', :bright_yellow) author = add_color('Author', :bright_yellow) url = add_color('URL', :bright_yellow) failures = [] + urgent = [] labels = [ title, triaged, author, url ] triaged_counter = 0 logger.info "Fetching today\'s failures..." @@ -47,16 +48,32 @@ triaged = add_color('✓', :green) && triaged_counter += 1 if emoji_awards.find do |e| e['name'] == emoji && e['user']['username'] == @username end + if @options[:urgent] + labels = failure["labels"] + + labels.each do |label| + if label.include? ("found:canary.gitlab.com" && "found:canary.staging.gitlab.com") + urgent << [title, triaged, author, url] + end + end + end + failures << [title, triaged, author, url] end end - table = TTY::Table.new(labels, failures) - puts table.render(:ascii, resize: true, alignments: [:center, :center, :center, :center]) - output.puts "\nFound: #{failures.size} failures, of these #{triaged_counter} have been triaged with a #{emoji}." + if @options[:urgent] + table = TTY::Table.new(labels, urgent) + puts table.render(:ascii, resize: true, alignments: [:center, :center, :center, :center]) + output.puts "\nFound: #{urgent.size} urgent failures, found in both canary.gitlab.com and canary.staging.gitlab.com." + else + table = TTY::Table.new(labels, failures) + puts table.render(:ascii, resize: true, alignments: [:center, :center, :center, :center]) + output.puts "\nFound: #{failures.size} failures, of these #{triaged_counter} have been triaged with a #{emoji}." + end end private def truncate(string, max)