当将Jenkins与Sonarqube Scanner集成时 我有詹金斯配置 ` //阶段检查声纳基任务状态 阶段(“检查Sonarqube任务状态”){ 步骤{ 脚本...

问题描述 投票:0回答:1
我试图从詹金斯(Jenkins)上从我的索纳克(Sonarqube)获得身份。但是我无法理解...当我检查我的Sonarqube状态时,我的代码已经通过了

但是当我检查詹金斯时,我有错误错误:无法从扫描仪输出中提取声纳克任务ID 完成:失败
我的代码正在使用Golang并在EC2
上部署

如何解决此问题?

我期望我的代码可以运行其他过程,例如

stage('Build Docker Image') { steps { sh 'docker build -t $GITLAB_REGISTRY/$IMAGE_NAME:latest .' } } stage('Login to GitLab Registry') { steps {}

如何解决此问题?

您可以在下面尝试使用配置。据我所知,这可能会有所帮助。
这是为了正确提取任务

def getSonarQubeTaskStatus(taskId) { def sonarApiUrl = "${env.SONARQUBE_SERVER}/api/ce/task?id=${taskId}" echo "Fetching SonarQube task status from: ${sonarApiUrl}" def response = httpRequest(url: sonarApiUrl, authentication: 'sonar-token') echo "SonarQube API Response: ${response.content}" def jsonResponse = readJSON text: response.content return jsonResponse.task.status

jenkins sonarqube jenkins-plugins
1个回答
0
投票

下面是用于检查任务状态。

def getSonarQubeTaskStatus(taskId) { def sonarApiUrl = "${env.SONARQUBE_SERVER}/api/ce/task?id=${taskId}" echo "Fetching SonarQube task status from: ${sonarApiUrl}" def response = httpRequest(url: sonarApiUrl, authentication: 'sonar-token') echo "SonarQube API Response: ${response.content}" def jsonResponse = readJSON text: response.content return jsonResponse.task.status

}
    

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.