Sha256: c2235b2a97d5bc9073b08ff92b777a1591ab3f212ac5042333498fcea0fd6de1

Contents?: true

Size: 1.89 KB

Versions: 11

Compression:

Stored size: 1.89 KB

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true

require "bundler/setup"
require "optparse"

require_relative "../lib/gitlab_quality/test_tooling"

params = {}

options = OptionParser.new do |opts|
  opts.banner = "Usage: #{$PROGRAM_NAME} [options]"

  opts.on('-i', '--input-files INPUT_FILES', String, 'RSpec report files (JSON or JUnit XML)') do |input_files|
    params[:input_files] = input_files
  end

  opts.on('--max-diff-ratio MAX_DIFF_RATO', Float, 'Max stacktrace diff ratio for failure issues detection') do |max_diff_ratio|
    params[:max_diff_ratio] = max_diff_ratio
  end

  opts.on('-p', '--project PROJECT', String, 'Can be an integer or a group/project string') do |project|
    params[:project] = project
  end

  opts.on('-t', '--token TOKEN', String, 'A valid access token with `api` scope and Maintainer permission in PROJECT') do |token|
    params[:token] = token
  end

  opts.on('--system-log-files SYSTEM_LOG_FILES', String,
    'Include errors from system logs in failure issues') do |system_log_files|
    params[:system_logs] = system_log_files
  end

  opts.on('--base-issue-labels BASE_ISSUE_LABELS', String,
    'Labels to add to new failure issues') do |base_issue_labels|
    params[:base_issue_labels] = base_issue_labels.split(',')
  end

  opts.on('--dry-run', "Perform a dry-run (don't create or update issues)") do
    params[:dry_run] = true
  end

  opts.on_tail('-v', '--version', 'Show the version') do
    require_relative "../lib/gitlab_quality/test_tooling/version"
    puts "#{$PROGRAM_NAME} : #{GitlabQuality::TestTooling::VERSION}"
    exit
  end

  opts.on_tail('-h', '--help', 'Show the usage') do
    puts "Purpose: Relate test failures to failure issues from RSpec report files (JSON or JUnit XML)"
    puts opts
    exit
  end

  opts.parse(ARGV)
end

if params.any?
  GitlabQuality::TestTooling::Report::RelateFailureIssue.new(**params).invoke!
else
  puts options
  exit 1
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
gitlab_quality-test_tooling-1.0.0 exe/relate-failure-issue
gitlab_quality-test_tooling-0.9.3 exe/relate-failure-issue
gitlab_quality-test_tooling-0.9.2 exe/relate-failure-issue
gitlab_quality-test_tooling-0.9.1 exe/relate-failure-issue
gitlab_quality-test_tooling-0.9.0 exe/relate-failure-issue
gitlab_quality-test_tooling-0.8.3 exe/relate-failure-issue
gitlab_quality-test_tooling-0.8.2 exe/relate-failure-issue
gitlab_quality-test_tooling-0.8.1 exe/relate-failure-issue
gitlab_quality-test_tooling-0.8.0 exe/relate-failure-issue
gitlab_quality-test_tooling-0.7.0 exe/relate-failure-issue
gitlab_quality-test_tooling-0.6.2 exe/relate-failure-issue