Sha256: 9cdad586e48431e00403321020698a2bc06dccc2953e628904abd8aa07d9c6a6

Contents?: true

Size: 842 Bytes

Versions: 17

Compression:

Stored size: 842 Bytes

Contents

# frozen_string_literal: true

require 'table_print'

module GitlabQuality
  module TestTooling
    module FailedJobsTable
      class << self
        # Create table with formatted list of failed jobs
        #
        # @param [Array<Gitlab::ObjectifiedHash>] jobs
        # @return [String]
        def create(jobs:)
          "```\n#{TablePrint::Printer.table_print(collect_results(jobs))}\n```\n"
        end

        private

        # Format list of failed jobs
        #
        # @param [Array<Gitlab::ObjectifiedHash>] jobs
        # @return [Array]
        def collect_results(jobs)
          jobs.sort_by(&:stage).map do |job|
            {
              "Job" => job.name,
              "Stage" => job.stage,
              "Failure Reason" => job.failure_reason
            }
          end
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
gitlab_quality-test_tooling-1.21.0 lib/gitlab_quality/test_tooling/failed_jobs_table.rb
gitlab_quality-test_tooling-1.20.1 lib/gitlab_quality/test_tooling/failed_jobs_table.rb
gitlab_quality-test_tooling-1.20.0 lib/gitlab_quality/test_tooling/failed_jobs_table.rb
gitlab_quality-test_tooling-1.19.1 lib/gitlab_quality/test_tooling/failed_jobs_table.rb
gitlab_quality-test_tooling-1.19.0 lib/gitlab_quality/test_tooling/failed_jobs_table.rb
gitlab_quality-test_tooling-1.18.0 lib/gitlab_quality/test_tooling/failed_jobs_table.rb
gitlab_quality-test_tooling-1.17.0 lib/gitlab_quality/test_tooling/failed_jobs_table.rb
gitlab_quality-test_tooling-1.15.0 lib/gitlab_quality/test_tooling/failed_jobs_table.rb
gitlab_quality-test_tooling-1.14.2 lib/gitlab_quality/test_tooling/failed_jobs_table.rb
gitlab_quality-test_tooling-1.14.1 lib/gitlab_quality/test_tooling/failed_jobs_table.rb
gitlab_quality-test_tooling-1.14.0 lib/gitlab_quality/test_tooling/failed_jobs_table.rb
gitlab_quality-test_tooling-1.13.0 lib/gitlab_quality/test_tooling/failed_jobs_table.rb
gitlab_quality-test_tooling-1.12.0 lib/gitlab_quality/test_tooling/failed_jobs_table.rb
gitlab_quality-test_tooling-1.11.0 lib/gitlab_quality/test_tooling/failed_jobs_table.rb
gitlab_quality-test_tooling-1.10.1 lib/gitlab_quality/test_tooling/failed_jobs_table.rb
gitlab_quality-test_tooling-1.10.0 lib/gitlab_quality/test_tooling/failed_jobs_table.rb
gitlab_quality-test_tooling-1.9.0 lib/gitlab_quality/test_tooling/failed_jobs_table.rb