Execute SonarQube Scanner within Jenkins 2 Pipeline

后端 未结 3 768
花落未央
花落未央 2020-12-10 09:12

I want to execute a \"SonarQube Scanner\" Step within my Jenkins 2.x Pipeline.

When I try to create a sample groovy within the pipeline-syntax I only get a groovy sc

3条回答
  •  悲哀的现实
    2020-12-10 09:58

    You can, instead, just provide the full path to ur sonar-runner. As shown in the below snippet.

    def runSonarScan(sonar_url){
        withEnv(['SONAR_HOST=' + sonar_url]) {
            sh '''
            $/opt/sonarqube/sonar-runner-2.4/bin/sonar-runner -e -Dsonar.host.url=${SONAR_HOST}
            '''
        }
    }
    

    If you have specific sonar properties add them as a sonar-project.properties file as shown here Sonar Project Properties

提交回复
热议问题