azatmurtazin / excoveralls_sonarqube

This package is deprecated. Please use Excoveralls xml output
MIT License
2 stars 0 forks source link

Upload sonarqube.xml to SonarQube #1

Open zinur opened 5 years ago

zinur commented 5 years ago

I would like to upload sonarqube.xml via Jenkins job to SonarQube, but I can't find a plugin which will pick up such file (sonarqube.xml). Please advise me something?

ilovemysillybanana commented 5 years ago

I would also like to know how to do that. It's not clear from the project how that would be done. Any help would be appreciated. @zinur did you find anything?

azatmurtazin commented 5 years ago

@zinur @ilovemysillybanana

I wasn't involved in configuration our jenkins server, we use Multibranch Pipeline for CI-tests. Our Elixir projects contain Jenkinsfile like that:

pipeline {
  stages {
    stage('test & coverage') {
      steps {
        sh 'make coverage'
      }
    }
    stage('SonarQube analysis') {
      steps {
        withSonarQubeEnv('sonarqube_env') {
          sh "${tool("sonarqube-scanner-latest")}/bin/sonar-scanner -Dsonar.branch=${env.CHANGE_BRANCH ?: env.BRANCH_NAME} -Dsonar.coverageReportPaths=cover/sonarqube.xml"
        }
      }
    }
  }
}

And sonar-project.properties:

sonar.projectKey = some_elixir_app
sonar.sources = lib

Also this article might be helpfull a bit: https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner+for+Jenkins