Skip to content

Commit

Permalink
[releng] Fix sonar on non pull requests
Browse files Browse the repository at this point in the history
Change-Id: Iad009e440aec540bbe3cb1631d2d6bbd192d760e
Signed-off-by: Philippe DUL <philippe.dul@thalesgroup.com>
  • Loading branch information
pdulth committed Nov 23, 2020
1 parent 452b66d commit 2f8ee9a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion vars/sonar.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def runSonar(String sonarProjectKey, String githubRepository, String sonarLoginT
def jacocoParameters = "-Dsonar.java.coveragePlugin=jacoco -Dsonar.core.codeCoveragePlugin=jacoco "
def sonarCommon = "sonar:sonar -Dsonar.projectKey=${sonarProjectKey} -Dsonar.organization=eclipse -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=${SONARCLOUD_TOKEN} -Dsonar.skipDesign=true -Dsonar.dynamic=reuseReports -Dsonar.java.source=${javaVersion} -Dsonar.scanner.force-deprecated-java-version=true "
def sonarBranchAnalysis = "-Dsonar.branch.name=${BRANCH_NAME}"
def sonarPullRequestAnalysis = "-Dsonar.pullrequest.provider=GitHub -Dsonar.pullrequest.github.repository=${githubRepository} -Dsonar.pullrequest.key=${CHANGE_ID} -Dsonar.pullrequest.branch=${CHANGE_BRANCH}"
def sonarPullRequestAnalysis = (github.isPullRequest() ? "-Dsonar.pullrequest.provider=GitHub -Dsonar.pullrequest.github.repository=${githubRepository} -Dsonar.pullrequest.key=${CHANGE_ID} -Dsonar.pullrequest.branch=${CHANGE_BRANCH}" : "")
def sonar = sonarCommon + jacocoParameters + (github.isPullRequest() ? sonarPullRequestAnalysis : sonarBranchAnalysis)
sh "mvn ${sonar}"
}
Expand Down

0 comments on commit 2f8ee9a

Please sign in to comment.