Skip to content

Commit

Permalink
fix: jenkins ci (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrexox authored Mar 21, 2023
1 parent 0a6b755 commit 290d81a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion spec/coverage_reporter/config_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,8 @@ Spectator.describe CoverageReporter::Config do
context "for Jenkins CI" do
before_each do
ENV["JENKINS_HOME"] = "defined"
ENV["BUILD_ID"] = "jenkins-number"
ENV["BUILD_ID"] = "jenkins-id"
ENV["BUILD_NUMBER"] = "jenkins-number"
ENV["BRANCH_NAME"] = "jenkins-branch"
ENV["ghprbPullId"] = "jenkins-pr"
end
Expand All @@ -240,6 +241,7 @@ Spectator.describe CoverageReporter::Config do
:repo_token => repo_token,
:service_name => "jenkins",
:service_number => "jenkins-number",
:service_job_id => "jenkins-id",
:service_branch => "jenkins-branch",
:service_pull_request => "jenkins-pr",
})
Expand Down
4 changes: 3 additions & 1 deletion src/coverage_reporter/ci/jenkins.cr
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ module CoverageReporter

Options.new(
service_name: "jenkins",
service_number: ENV["BUILD_ID"]?,
service_number: ENV["BUILD_NUMBER"]?,
service_job_id: ENV["BUILD_ID"]?,
service_branch: ENV["BRANCH_NAME"]? || ENV["CHANGE_BRANCH"]?,
service_build_url: ENV["BUILD_URL"]?,
service_job_url: ENV["BUILD_URL"]?,
service_pull_request: ENV["CHANGE_ID"]? || ENV["ghprbPullId"]?,
).to_h
end
Expand Down

0 comments on commit 290d81a

Please sign in to comment.