From 290d81ae970053a39ff55a1597679257ae423390 Mon Sep 17 00:00:00 2001 From: Valentin Kiselev Date: Tue, 21 Mar 2023 10:20:01 +0300 Subject: [PATCH] fix: jenkins ci (#39) --- spec/coverage_reporter/config_spec.cr | 4 +++- src/coverage_reporter/ci/jenkins.cr | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/spec/coverage_reporter/config_spec.cr b/spec/coverage_reporter/config_spec.cr index 5f9033fb..9e8ac9a3 100644 --- a/spec/coverage_reporter/config_spec.cr +++ b/spec/coverage_reporter/config_spec.cr @@ -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 @@ -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", }) diff --git a/src/coverage_reporter/ci/jenkins.cr b/src/coverage_reporter/ci/jenkins.cr index e6376007..5fd9bb70 100644 --- a/src/coverage_reporter/ci/jenkins.cr +++ b/src/coverage_reporter/ci/jenkins.cr @@ -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