Skip to content

Commit

Permalink
Merge pull request FRRouting#94 from RodrigoMNardi/bug/github/address…
Browse files Browse the repository at this point in the history
…_sanitize_errors

Update Status
  • Loading branch information
RodrigoMNardi authored Aug 25, 2024
2 parents 8f79a40 + 599b6d2 commit c09123a
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 16 deletions.
19 changes: 3 additions & 16 deletions lib/github/update_status.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,24 +121,11 @@ def current_execution?
def failure
@job.failure(@github_check)

retrieve_stats
end

def retrieve_stats
return failures_stats if @failures.is_a? Array and !@failures.empty?

retrieve_errors
end

def retrieve_errors
@retrieve_error = Github::TopotestFailures::RetrieveError.new(@job)
@retrieve_error.retrieve

return if @retrieve_error.failures.empty?

@failures = @retrieve_error.failures

failures_stats
CiJobFetchTopotestFailures
.delay(run_at: 60.seconds.from_now, queue: 'fetch_topotest_failures')
.update(@job.id)
end

def slack_notify_success
Expand Down
2 changes: 2 additions & 0 deletions lib/github_ci_app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@
require_relative 'helpers/sinatra_payload'
require_relative 'helpers/telemetry'

# Workers
require_relative '../workers/ci_job_status'
require_relative '../workers/ci_job_fetch_topotest_failures'

# Slack libs
require_relative 'slack/slack'
Expand Down
30 changes: 30 additions & 0 deletions workers/ci_job_fetch_topotest_failures.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# SPDX-License-Identifier: BSD-2-Clause
#
# ci_job_fetch_topotest_failures.rb
# Part of NetDEF CI System
#
# Copyright (c) 2024 by
# Network Device Education Foundation, Inc. ("NetDEF")
#
# frozen_string_literal: true

class CiJobFetchTopotestFailures
def self.update(ci_job_id)
@job = CiJob.find(ci_job_id)

@retrieve_error = Github::TopotestFailures::RetrieveError.new(@job)
@retrieve_error.retrieve

return if @retrieve_error.failures.empty?

@failures = @retrieve_error.failures

@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

0 comments on commit c09123a

Please sign in to comment.