Skip to content

Commit 04ab01f

Browse files
committed
Update Status
Apparently, address sanitize errors take a long time to be made available in the Bamboo API, so we will use the Delayed Job to retrieve the execution results after 1 minute. Signed-off-by: Rodrigo Nardi <rnardi@netdef.org>
1 parent 8f79a40 commit 04ab01f

2 files changed

Lines changed: 39 additions & 16 deletions

File tree

lib/github/update_status.rb

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -121,24 +121,11 @@ def current_execution?
121121
def failure
122122
@job.failure(@github_check)
123123

124-
retrieve_stats
125-
end
126-
127-
def retrieve_stats
128124
return failures_stats if @failures.is_a? Array and !@failures.empty?
129125

130-
retrieve_errors
131-
end
132-
133-
def retrieve_errors
134-
@retrieve_error = Github::TopotestFailures::RetrieveError.new(@job)
135-
@retrieve_error.retrieve
136-
137-
return if @retrieve_error.failures.empty?
138-
139-
@failures = @retrieve_error.failures
140-
141-
failures_stats
126+
CiJobFetchTopotestFailures
127+
.delay(run_at: 60.seconds.from_now, queue: 'fetch_topotest_failures')
128+
.update(@job.id)
142129
end
143130

144131
def slack_notify_success
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# SPDX-License-Identifier: BSD-2-Clause
2+
#
3+
# ci_job_fetch_topotest_failures.rb
4+
# Part of NetDEF CI System
5+
#
6+
# Copyright (c) 2024 by
7+
# Network Device Education Foundation, Inc. ("NetDEF")
8+
#
9+
# frozen_string_literal: true
10+
11+
class CiJobFetchTopotestFailures
12+
def self.update(ci_job_id)
13+
@job = CiJob.find(ci_job_id)
14+
15+
@retrieve_error = Github::TopotestFailures::RetrieveError.new(@job)
16+
@retrieve_error.retrieve
17+
18+
return if @retrieve_error.failures.empty?
19+
20+
@failures = @retrieve_error.failures
21+
22+
failures_stats
23+
end
24+
25+
private
26+
27+
def failures_stats
28+
@failures.each do |failure|
29+
TopotestFailure.create(ci_job: @job,
30+
test_suite: failure['suite'],
31+
test_case: failure['case'],
32+
message: failure['message'],
33+
execution_time: failure['execution_time'])
34+
end
35+
end
36+
end

0 commit comments

Comments
 (0)