-
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 branch 'master' into hotfix/debian12
- Loading branch information
Showing
14 changed files
with
303 additions
and
74 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
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,45 @@ | ||
# SPDX-License-Identifier: BSD-2-Clause | ||
# | ||
# skip_old_tests.rb | ||
# Part of NetDEF CI System | ||
# | ||
# Copyright (c) 2024 by | ||
# Network Device Education Foundation, Inc. ("NetDEF") | ||
# | ||
# frozen_string_literal: true | ||
|
||
module Github | ||
module Build | ||
class SkipOldTests | ||
attr_reader :stages | ||
|
||
def initialize(check_suite) | ||
@check_suite = check_suite | ||
@github = Github::Check.new(@check_suite) | ||
@stages = StageConfiguration.all.map { |config| "[CI] #{config.github_check_run_name}" } | ||
@logger = GithubLogger.instance.create('github_skip_old_tests.log', Logger::INFO) | ||
end | ||
|
||
def skip_old_tests | ||
%w[queued in_progress success failure queued].each do |status| | ||
@github | ||
.check_runs_for_ref(@check_suite.pull_request.repository, | ||
@check_suite.commit_sha_ref, status: status)[:check_runs] | ||
&.each { |check_run| skipping_old_test(check_run) } | ||
end | ||
end | ||
|
||
private | ||
|
||
def skipping_old_test(check_run) | ||
return if check_run[:app][:name] != 'NetDEF CI Hook' or @stages.include?(check_run[:name]) | ||
|
||
@logger.info("Skipping old test suite: #{check_run[:name]}") | ||
puts("Skipping old test suite: #{check_run[:name]}") | ||
|
||
message = 'Old test suite, skipping...' | ||
@github.skipped(check_run[:id], { title: "#{check_run[:name]} summary", summary: message }) | ||
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
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
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
Oops, something went wrong.