Jenkins SonarQube按本地路径扫描

时间:2019-09-16 19:02:06

标签: jenkins sonarqube

我正在尝试使用Sonarqube扫描jenkins中的c#代码,为此,我创建了pipline项目并编写了如下脚本,并在jenkin工具中配置了声纳服务器。 是否可以通过提供路径在特定位置使用本地扫描仪进行扫描? (不过我可以通过MAC终端扫描我的代码。)

我遇到错误了

.jenkins / workspace / sonar-scanner-msbuild-4.6.2.2108-net46 / SonarScanner.MSBuild.exe:无法执行二进制文件 [管道]} 警告:无法在工作区中找到“ report-task.txt”。 SonarScanner成功了吗?

管道{     代理任何     阶段{         stage(“结帐代码”){

       steps {

       git(
        url: 'https://SCM Path.....git',
        credentialsId: 'XXXXX',
         branch: "cicd"
        )        
            }
    }

     stage('Build + SonarQube analysis') {
        agent any

        steps {
              script {
                    sqScannerMsBuildHome = tool 'SonarScanerMSBuild' 

                }
        withSonarQubeEnv('SonarScanServer') {
                  // sh "${scannerHome}"
                  sh "$JENKINS_HOME/workspace/sonar-scanner-msbuild-4.6.2.2108-net46/SonarScanner.MSBuild.exe begin /k:CICDKey"
                  sh "$WORKSPACE/SickLeaveTracker /t:Rebuild"
                  sh "$JENKINS_HOME/workspace/sonar-scanner-msbuild-4.6.2.2108-net46/SonarScanner.MSBuild.exe end" 
          }


                }
        }

         stage("Quality Gate") {
           steps {
            timeout(time: 1, unit: 'HOURS') {
                // Parameter indicates whether to set pipeline to UNSTABLE if Quality Gate fails
                // true = set pipeline to UNSTABLE, false = don't
                waitForQualityGate abortPipeline: true
            }
        }
    }

}

}

0 个答案:

没有答案