-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #92 from FRRouting/master
Release 2.3.7
- Loading branch information
Showing
5 changed files
with
130 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# SPDX-License-Identifier: BSD-2-Clause | ||
# | ||
# retrieve_error.rb | ||
# Part of NetDEF CI System | ||
# | ||
# Copyright (c) 2024 by | ||
# Network Device Education Foundation, Inc. ("NetDEF") | ||
# | ||
# frozen_string_literal: true | ||
|
||
module Github | ||
module TopotestFailures | ||
class RetrieveError | ||
attr_reader :failures | ||
|
||
def initialize(job) | ||
@job = job | ||
@failures = [] | ||
end | ||
|
||
def retrieve | ||
fetch_failures(BambooCi::Result.fetch(@job.job_ref)) | ||
|
||
@failures | ||
end | ||
|
||
def fetch_failures(output) | ||
output.dig('testResults', 'failedTests', 'testResult')&.each do |test_result| | ||
@failures << { | ||
'suite' => test_result['className'], | ||
'case' => test_result['methodName'], | ||
'message' => test_result.dig('errors', 'error').map { |error| error['message'] }.join("\n"), | ||
'execution_time' => test_result['durationInSeconds'] | ||
} | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# SPDX-License-Identifier: BSD-2-Clause | ||
# | ||
# retrieve_address_sanitizer_error.rb | ||
# | ||
# > Overview | ||
# The retrieve_address_sanitizer_error.rb script is part of the NetDEF CI System. | ||
# It is designed to retrieve and log AddressSanitizer errors from CI jobs that have failed. | ||
# The script processes CI jobs, retrieves errors using the Github::TopotestFailures::RetrieveError class, | ||
# and logs these errors into the TopotestFailure model. | ||
# | ||
# Part of NetDEF CI System | ||
# | ||
# Copyright (c) 2024 by | ||
# Network Device Education Foundation, Inc. ("NetDEF") | ||
# | ||
# frozen_string_literal: true | ||
|
||
require_relative '../config/setup' | ||
|
||
CiJob | ||
.left_outer_joins(:topotest_failures) | ||
.joins(:stage) | ||
.where(topotest_failures: { id: nil }) | ||
.where("ci_jobs.name LIKE '%AddressSanitizer%'") | ||
.where(status: :failure) | ||
.where(stage: { status: :failure }) | ||
.where('ci_jobs.created_at > ?', 6.month.ago) | ||
.each do |job| | ||
next if job.topotest_failures.any? | ||
|
||
CiJob.transaction do | ||
failures = Github::TopotestFailures::RetrieveError.new(job).retrieve | ||
|
||
puts "Found #{failures.size} failures for job #{job.job_ref}" | ||
|
||
next if failures.empty? | ||
|
||
failures.each do |failure| | ||
TopotestFailure.create(ci_job: job, | ||
test_suite: failure['suite'], | ||
test_case: failure['case'], | ||
message: failure['message'], | ||
execution_time: failure['execution_time']) | ||
end | ||
end | ||
end |