- 已编辑
请问这个问题怎么解决,我折腾两天了,google百度了全不行,希望有大侠能出面解决一下。
请问这个问题怎么解决,我折腾两天了,google百度了全不行,希望有大侠能出面解决一下。
为了从 UI 页面直接能够点击跳转到 Sonarqube 页面,需要如下配置
kubectl edit cm -n kubesphere-system ks-console-config
这个配置在每次升级或者ks-installer重启后都会消失需要重新配置,是不是有个地方可以配置永久生效
大佬 我按照你这种方式 是可以加载到sonar 但是我sonar加载完后报错
#####报错信息
No previous SonarQube analysis found on this pipeline execution. Please use the ‘withSonarQubeEnv’ wrapper to run your analysis.
######
我的通过kubesphere生成的Jenkinsfile
stage('Code Analysis') {
agent none
steps {
container('maven') {
withCredentials([string(credentialsId : 'sonar' ,variable : 'SONAR_TOKEN' ,)]) {
withSonarQubeEnv('sonar') {
sh '''mvn -B sonar:sonar -Dsonar.login=$SONAR_TOKEN -Dsonar.projectKey=demo-test
'''
timeout(unit: 'MINUTES', activity: true, time: 2) {
waitForQualityGate 'true'
}
}
}
}
}
}
1934801322 参考官网 使用 Jenkinsfile 创建流水线 配置 SonarQube 的 token 配置了吗 ?
1934801322
看报错是 等待代码检查 这一步报错了,麻烦参考这个截图修改下,然后在运行下流水线;
1934801322 凭证列表里有名称是 sonar 的凭证吗 ?
1934801322 这个 timeout 段落格式麻烦参考我上面的截图调整下,然后在试下;
1934801322
你调整后的格式还是跟这个不一样;
1934801322 这个格式还是没有改,在手动编辑下 jenkinsfile ,修改我上面截图的那一段;
1934801322 哦,这个文件可以不用,这个 mvn 命令还用你之前的;只不过格式改下:
container('maven') {
withCredentials([string(credentialsId: "sonar", variable: 'SONAR_TOKEN')]) {
withSonarQubeEnv('sonar') {
sh '''mvn sonar:sonar -Dsonar.login=$SONAR_TOKEN'''
}
}
timeout(time: 1, unit: 'HOURS') {
waitForQualityGate abortPipeline: true
}
}
yudong
####报错信息
####配置信息
stage('Code Analysis') {
agent none
steps {
container('maven') {
withCredentials([string(credentialsId : 'sonar' ,variable : 'SONAR_TOKEN' ,)]) {
withSonarQubeEnv('sonar') {
sh '''mvn sonar:sonar -Dsonar.login=$SONAR_TOKEN
'''
timeout(time: 1, unit: 'HOURS') {
waitForQualityGate abortPipeline: 'true'
}
}
}
}
}
}
####目前就是一直卡在 这个报错
No previous SonarQube analysis found on this pipeline execution. Please use the ‘withSonarQubeEnv’ wrapper to run your analysis.