Skip to content

Commit

Permalink
Move method to scm_status_reporter
Browse files Browse the repository at this point in the history
  • Loading branch information
krauselukas authored and eduardoj committed Sep 27, 2022
1 parent c9a1370 commit 3415d5e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 25 deletions.
11 changes: 0 additions & 11 deletions src/api/app/services/github_status_reporter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,6 @@ def call
# rubocop:enable Metrics/PerceivedComplexity
# rubocop:enable Metrics/CyclomaticComplexity

def self.scm_final_state(event_type)
case event_type
when 'Event::BuildFail'
'failure'
when 'Event::BuildSuccess'
'success'
else
'pending'
end
end

# TODO: extract to a parent class
def status_options
if @initial_report
Expand Down
11 changes: 0 additions & 11 deletions src/api/app/services/gitlab_status_reporter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,6 @@ def call
RabbitmqBus.send_to_bus('metrics', "scm_status_report,status=fail,scm=#{@event_subscription_payload[:scm]},exception=#{e.class} value=1") if @workflow_run.present?
end

def self.scm_final_state(event_type)
case event_type
when 'Event::BuildFail'
'failed'
when 'Event::BuildSuccess'
'success'
else
'pending'
end
end

# TODO: extract to a parent class
def status_options
if @initial_report
Expand Down
9 changes: 6 additions & 3 deletions src/api/app/services/scm_status_reporter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,13 @@ def gitea?
private

def scm_final_state(event_type)
if github?
GithubStatusReporter.scm_final_state(event_type)
case event_type
when 'Event::BuildFail'
'failure'
when 'Event::BuildSuccess'
'success'
else
GitlabStatusReporter.scm_final_state(event_type)
'pending'
end
end
end

0 comments on commit 3415d5e

Please sign in to comment.