Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'qa/tasks/knapsack.rake')
-rw-r--r--qa/tasks/knapsack.rake25
1 files changed, 19 insertions, 6 deletions
diff --git a/qa/tasks/knapsack.rake b/qa/tasks/knapsack.rake
index fe9a9c4586f..c1225964aef 100644
--- a/qa/tasks/knapsack.rake
+++ b/qa/tasks/knapsack.rake
@@ -1,6 +1,5 @@
# frozen_string_literal: true
-# rubocop:disable Rails/RakeEnvironment
namespace :knapsack do
desc "Run tests with knapsack runner"
task :rspec, [:rspec_args] do |_, args|
@@ -16,11 +15,26 @@ namespace :knapsack do
exit QA::Specs::KnapsackRunner.run(rspec_args)
end
- desc "Download latest knapsack report or multiple reports passed via QA_KNAPSACK_REPORTS env variable"
- task :download do
- next QA::Support::KnapsackReport.download_report unless ENV["QA_KNAPSACK_REPORTS"]
+ desc "Download latest knapsack reports for parallel jobs"
+ task :download, [:stage_name] do |_, args|
+ test_stage_name = args[:stage_name]
- ENV["QA_KNAPSACK_REPORTS"].split(",").each do |report_name|
+ # QA_KNAPSACK_REPORTS remains for changes to be backwards compatible
+ # TODO: remove and only use automated detection once changes are merged
+ unless ENV["QA_KNAPSACK_REPORTS"] || test_stage_name
+ QA::Runtime::Logger.warn("Missing QA_KNAPSACK_REPORTS environment variable or test stage name for autodetection")
+ next
+ end
+
+ reports = if test_stage_name
+ QA::Support::ParallelPipelineJobs
+ .fetch(stage_name: test_stage_name, access_token: ENV["QA_GITLAB_CI_TOKEN"])
+ .map { |job| job.tr(":", "-") }
+ else
+ ENV["QA_KNAPSACK_REPORTS"].split(",")
+ end
+
+ reports.each do |report_name|
QA::Support::KnapsackReport.new(report_name).download_report
rescue StandardError => e
QA::Runtime::Logger.error(e)
@@ -37,4 +51,3 @@ namespace :knapsack do
QA::Tools::LongRunningSpecReporter.execute
end
end
-# rubocop:enable Rails/RakeEnvironment