Skip to content

Commit

Permalink
Update sonar
Browse files Browse the repository at this point in the history
  • Loading branch information
pdulth committed Jan 24, 2024
1 parent 20161eb commit aa81b2c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions vars/sonar.groovy
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@


def runSonar(String sonarProjectKey, String githubRepository, String sonarLoginToken, javaVersion = "8"){
def runSonar(String sonarProjectKey, String githubRepository, String sonarLoginToken, javaVersion = "17"){
withCredentials([string(credentialsId: "${sonarLoginToken}", variable: 'SONARCLOUD_TOKEN')]) {
withEnv(['MAVEN_OPTS=-Xmx4g']) {
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 sonarCommon = "sonar:sonar -Dsonar.projectKey=${sonarProjectKey} -Dsonar.organization=eclipse -Dsonar.sources=src -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 = (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)
Expand Down

0 comments on commit aa81b2c

Please sign in to comment.