SonarQube 发布质量门结果错误 400:API GET '/api/ce/task' 失败,状态代码为:400
SonarQube Publish Quality Gate Result error 400: API GET '/api/ce/task' failed, status code was: 400
按预期生成构建警告后,我发现我的 SonarQube 发布质量门结果步骤出现错误 400,我似乎在设置它时遇到了一些死胡同。
日志显示:
##[debug][SQ] API GET: '/api/ce/task' with query "{"id":"AXsb0WQ3LC6AkZHS05UY","additionalFields":"warnings"}"
##[debug]Response: 200 Body: "{"task":{"id":"AXsb0WQ3LC6AkZHS05UY","type":"REPORT","componentId":"AXsbe3pELC6AkZHS05UN","componentKey":"my-project-key","componentName":"my-component-namel","componentQualifier":"TRK","status":"IN_PROGRESS","submittedAt":"2021-08-06T15:15:12+0100","submitterLogin":"admin","startedAt":"2021-08-06T15:15:13+0100","executionTimeMs":24228,"logs":false,"organization":"default-organization"}}"
##[debug][SQ] Task status:IN_PROGRESS
##[debug][SQ] Waiting for task 'AXsb0WQ3LC6AkZHS05UY' to complete.
##[debug][SQ] API GET: '/api/ce/task' with query "{"id":"AXsb0WQ3LC6AkZHS05UY","additionalFields":"warnings"}"
##[debug]Response: 200 Body: "{"task":{"id":"AXsb0WQ3LC6AkZHS05UY","type":"REPORT","componentId":"AXsbe3pELC6AkZHS05UN","componentKey":"my-project-key","componentName":"my-component-namel","componentQualifier":"TRK","status":"IN_PROGRESS","submittedAt":"2021-08-06T15:15:12+0100","submitterLogin":"admin","startedAt":"2021-08-06T15:15:13+0100","executionTimeMs":25343,"logs":false,"organization":"default-organization"}}"
##[debug][SQ] Task status:IN_PROGRESS
##[debug][SQ] Waiting for task 'AXsb0WQ3LC6AkZHS05UY' to complete.
##[debug][SQ] API GET: '/api/ce/task' with query "{"id":"AXsb0WQ3LC6AkZHS05UY","additionalFields":"warnings"}"
##[debug]Response: 400 Body: "{"errors":[{"msg":"Value of parameter 'additionalFields' (warnings) must be one of: [stacktrace, scannerContext]"}]}"
##[debug][SQ] API GET '/api/ce/task' failed, status code was: 400
##[error][SQ] API GET '/api/ce/task' failed, status code was: 400
##[debug]Processed: ##vso[task.issue type=error;][SQ] API GET '/api/ce/task' failed, status code was: 400
##[debug][SQ] Publish task error: [SQ] Could not fetch task for ID 'AXsb0WQ3LC6AkZHS05UY'
##[debug]task result: Failed
##[error][SQ] Could not fetch task for ID 'AXsb0WQ3LC6AkZHS05UY'
##[debug]Processed: ##vso[task.issue type=error;][SQ] Could not fetch task for ID 'AXsb0WQ3LC6AkZHS05UY'
##[debug]Processed: ##vso[task.complete result=Failed;][SQ] Could not fetch task for ID 'AXsb0WQ3LC6AkZHS05UY'
Finishing: SonarQubePublish
奇怪的是,日志显示相同的 API GET:'/api/ce/task' 请求 运行 相同的参数并在到达之前收到 200 响应:
##[debug][SQ] API GET '/api/ce/task' failed, status code was: 400
##[error][SQ] API GET '/api/ce/task' failed, status code was: 400
##[debug]Processed: ##vso[task.issue type=error;][SQ] API GET '/api/ce/task' failed, status code was: 400
##[debug][SQ] Publish task error: [SQ] Could not fetch task for ID 'AXsb0WQ3LC6AkZHS05UY'
##[debug]task result: Failed
##[error][SQ] Could not fetch task for ID 'AXsb0WQ3LC6AkZHS05UY'
我发现了同一个 GET 请求的 404 和 401 错误示例,但没有提到 400 响应。
Azure DevOps 配置如下所示:
- task: SonarQubePrepare@4
inputs:
SonarQube: 'SonarQube Connection'
scannerMode: 'MSBuild'
projectKey: 'my-project-key'
projectName: 'my-project-name'
extraProperties: |
# Additional properties that will be passed to the scanner,
# Put one key=value per line, example:
# sonar.exclusions=**/*.bin
sonar.verbose=true
# Build the entire solution so the test assemblies are available
- task: VSBuild@1
displayName: 'Build solution'
inputs:
solution: MySolution.sln
platform: 'Any CPU'
configuration: 'Release'
- task: SonarQubeAnalyze@4
- task: SonarQubePublish@4
inputs:
pollingTimeoutSec: '300'
我是 运行 来自云端的 Devops(如果重要的话)和 SonarQube v 6.7。我做错了什么?
按预期生成构建警告后,我发现我的 SonarQube 发布质量门结果步骤出现错误 400,我似乎在设置它时遇到了一些死胡同。
日志显示:
##[debug][SQ] API GET: '/api/ce/task' with query "{"id":"AXsb0WQ3LC6AkZHS05UY","additionalFields":"warnings"}"
##[debug]Response: 200 Body: "{"task":{"id":"AXsb0WQ3LC6AkZHS05UY","type":"REPORT","componentId":"AXsbe3pELC6AkZHS05UN","componentKey":"my-project-key","componentName":"my-component-namel","componentQualifier":"TRK","status":"IN_PROGRESS","submittedAt":"2021-08-06T15:15:12+0100","submitterLogin":"admin","startedAt":"2021-08-06T15:15:13+0100","executionTimeMs":24228,"logs":false,"organization":"default-organization"}}"
##[debug][SQ] Task status:IN_PROGRESS
##[debug][SQ] Waiting for task 'AXsb0WQ3LC6AkZHS05UY' to complete.
##[debug][SQ] API GET: '/api/ce/task' with query "{"id":"AXsb0WQ3LC6AkZHS05UY","additionalFields":"warnings"}"
##[debug]Response: 200 Body: "{"task":{"id":"AXsb0WQ3LC6AkZHS05UY","type":"REPORT","componentId":"AXsbe3pELC6AkZHS05UN","componentKey":"my-project-key","componentName":"my-component-namel","componentQualifier":"TRK","status":"IN_PROGRESS","submittedAt":"2021-08-06T15:15:12+0100","submitterLogin":"admin","startedAt":"2021-08-06T15:15:13+0100","executionTimeMs":25343,"logs":false,"organization":"default-organization"}}"
##[debug][SQ] Task status:IN_PROGRESS
##[debug][SQ] Waiting for task 'AXsb0WQ3LC6AkZHS05UY' to complete.
##[debug][SQ] API GET: '/api/ce/task' with query "{"id":"AXsb0WQ3LC6AkZHS05UY","additionalFields":"warnings"}"
##[debug]Response: 400 Body: "{"errors":[{"msg":"Value of parameter 'additionalFields' (warnings) must be one of: [stacktrace, scannerContext]"}]}"
##[debug][SQ] API GET '/api/ce/task' failed, status code was: 400
##[error][SQ] API GET '/api/ce/task' failed, status code was: 400
##[debug]Processed: ##vso[task.issue type=error;][SQ] API GET '/api/ce/task' failed, status code was: 400
##[debug][SQ] Publish task error: [SQ] Could not fetch task for ID 'AXsb0WQ3LC6AkZHS05UY'
##[debug]task result: Failed
##[error][SQ] Could not fetch task for ID 'AXsb0WQ3LC6AkZHS05UY'
##[debug]Processed: ##vso[task.issue type=error;][SQ] Could not fetch task for ID 'AXsb0WQ3LC6AkZHS05UY'
##[debug]Processed: ##vso[task.complete result=Failed;][SQ] Could not fetch task for ID 'AXsb0WQ3LC6AkZHS05UY'
Finishing: SonarQubePublish
奇怪的是,日志显示相同的 API GET:'/api/ce/task' 请求 运行 相同的参数并在到达之前收到 200 响应:
##[debug][SQ] API GET '/api/ce/task' failed, status code was: 400
##[error][SQ] API GET '/api/ce/task' failed, status code was: 400
##[debug]Processed: ##vso[task.issue type=error;][SQ] API GET '/api/ce/task' failed, status code was: 400
##[debug][SQ] Publish task error: [SQ] Could not fetch task for ID 'AXsb0WQ3LC6AkZHS05UY'
##[debug]task result: Failed
##[error][SQ] Could not fetch task for ID 'AXsb0WQ3LC6AkZHS05UY'
我发现了同一个 GET 请求的 404 和 401 错误示例,但没有提到 400 响应。
Azure DevOps 配置如下所示:
- task: SonarQubePrepare@4
inputs:
SonarQube: 'SonarQube Connection'
scannerMode: 'MSBuild'
projectKey: 'my-project-key'
projectName: 'my-project-name'
extraProperties: |
# Additional properties that will be passed to the scanner,
# Put one key=value per line, example:
# sonar.exclusions=**/*.bin
sonar.verbose=true
# Build the entire solution so the test assemblies are available
- task: VSBuild@1
displayName: 'Build solution'
inputs:
solution: MySolution.sln
platform: 'Any CPU'
configuration: 'Release'
- task: SonarQubeAnalyze@4
- task: SonarQubePublish@4
inputs:
pollingTimeoutSec: '300'
我是 运行 来自云端的 Devops(如果重要的话)和 SonarQube v 6.7。我做错了什么?