1. Parse bisect log by git command. 2. Create a bisect log file. 3. Upload the bisect log file.
Signed-off-by: Cao Xueliang caoxl78320@163.com --- src/delimiter/constants.rb | 1 + src/delimiter/utils.rb | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+)
diff --git a/src/delimiter/constants.rb b/src/delimiter/constants.rb index 04f87f4..5e5406f 100644 --- a/src/delimiter/constants.rb +++ b/src/delimiter/constants.rb @@ -10,3 +10,4 @@ DELIMITER_ACCONUT = ENV['DELIMITER_ACCONUT'] || 'compass-ci@qq.com' TMEP_GIT_BASE = '/c/public_git' DELIMITER_TASK_QUEUE = 'delimiter' BISECT_RUN_SCRIPT = "#{ENV['CCI_SRC']}/src/delimiter/find-commit/bisect_run_script.rb" +RESULT_WEBDAV_URL = ENV['RESULT_WEBDAV_URL'] || "http://172.17.0.1:3080" diff --git a/src/delimiter/utils.rb b/src/delimiter/utils.rb index 90c3cce..60b64a1 100644 --- a/src/delimiter/utils.rb +++ b/src/delimiter/utils.rb @@ -113,5 +113,27 @@ module Utils
return job end + + def parse_bisect_log(git_dir) + bisect_log = %x(git -C #{git_dir} bisect log) + bisect_log_arr = bisect_log.split(/\n/) + bisect_log_arr.keep_if { |item| item.start_with?('#') } + + return bisect_log_arr + end + + def create_bisect_log(job_id, git_dir) + log_file = File.join(git_dir, "#{job_id}_bisect.log") + log_content = parse_bisect_log(git_dir) + File.open(log_file, 'w') do |f| + log_content.each { |line| f.puts(line) } + end + + return log_file + end + + def upload_bisect_log(log_file, dest_dir, access_key) + %x(curl -sSf -T "#{log_file}" #{RESULT_WEBDAV_URL}/#{dest_dir} --cookie "ACCESSKEY=#{access_key}") + end end end