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:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-10-20 06:08:06 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-10-20 06:08:06 +0300
commit400c252e34e0d5810214f27cc623aaa28c028755 (patch)
tree0b4eba2b86f706ce97d0561124c461166dc43ed7 /scripts/merge-auto-explain-logs
parent1533e64a2ca36d119ba2f229f591e4b50c436338 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'scripts/merge-auto-explain-logs')
-rwxr-xr-xscripts/merge-auto-explain-logs39
1 files changed, 33 insertions, 6 deletions
diff --git a/scripts/merge-auto-explain-logs b/scripts/merge-auto-explain-logs
index 0dff4fb33f8..23ddf65be69 100755
--- a/scripts/merge-auto-explain-logs
+++ b/scripts/merge-auto-explain-logs
@@ -1,14 +1,41 @@
#!/usr/bin/env ruby
# frozen_string_literal: true
-require "set"
-require "json"
+require 'json'
+require 'set'
+require 'zlib'
+
+source = ENV['CI_MERGE_REQUEST_SOURCE_BRANCH_SHA']
+target = ENV['CI_MERGE_REQUEST_TARGET_BRANCH_SHA']
+log_path = ENV['RSPEC_AUTO_EXPLAIN_LOG_PATH']
+logs_path = File.dirname(log_path)
+
+exit(0) unless Dir.exist?(logs_path)
fingerprints = Set.new
+jobs = Set.new
+
+JOB_NAME = %r{^(.*)\.\d+\.[^.]+\.ndjson\.gz$}
+
+Zlib::GzipWriter.open(log_path) do |log|
+ Dir[File.join(logs_path, '*.gz')].reject { |p| p == log_path }.each do |file|
+ job_name = File.basename(file)[JOB_NAME, 1]
+ Zlib::GzipReader.open(file) do |gz|
+ gz.each_line do |line|
+ json = JSON.parse(line)
+ fingerprint = json['fingerprint']
+
+ next unless fingerprints.add?(fingerprint)
+
+ jobs << job_name
+ json['job_name'] = job_name
+ log.puts(json.to_s)
+ end
+ end
-ARGF.each_line do |line|
- fingerprint = JSON.parse(line)['fingerprint']
- $stdout.puts(line) && $stdout.flush if fingerprints.add?(fingerprint)
+ File.delete(file)
+ end
end
-warn("auto_explain log contains #{fingerprints.size} entries")
+warn("auto_explain log contains #{fingerprints.size} entries from: #{jobs.to_a.sort.join(', ')}")
+warn("auto_explain comparison of #{target} to #{source}") if source && target