SonarQube 6.7 LTS组权限API没有';行不通
我正在将SonarQube从5.6版迁移到6.7版。我在Jenkins作业中使用SonarQube API,问题是组权限的API不适用于6.7版本 我已经用Postman(POST raw JSON)手动尝试了以下方法: 返回的结果是:SonarQube 6.7 LTS组权限API没有';行不通,sonarqube,sonarqube-api,Sonarqube,Sonarqube Api,我正在将SonarQube从5.6版迁移到6.7版。我在Jenkins作业中使用SonarQube API,问题是组权限的API不适用于6.7版本 我已经用Postman(POST raw JSON)手动尝试了以下方法: 返回的结果是: { "errors": [ { "msg": "Group name or group id must be provided" } ] } 如果我使用: { "groupId":
{
"errors": [
{
"msg": "Group name or group id must be provided"
}
]
}
如果我使用:
{
"groupId": 53,
"permission": "admin",
"projectKey": "project-name"
}
或
它与6.5 verison一起工作,我不知道这个问题可能来自哪里:(
@SonarQube开发团队:您能修复Thaaat吗?将数据作为或表单数据发送。
SonarQube Web API不处理原始JSON格式的帖子正文。请参阅以下关于Java ServletRequest了解更多信息(Tomcat在后台使用)。这是一段使用身份验证和帖子将项目分配给门户的代码。注意正文和内容类型
// format post, sonarqube only knows form encoded
def body = sprintf("gateId=%s&projectKey=%s", ["${gateId}", "${projectKey}"])
// post to associate project with gate
result = httpRequest (
consoleLogResponseBody: true,
authentication: '<My Jenkins Credential>',
contentType: 'APPLICATION_FORM',
httpMode: 'POST',
ignoreSslErrors: true,
requestBody: "${body}",
url: "http://<sonarqube.url>/api/qualitygates/select"
)
//格式化post,sonarqube只知道表单编码
def body=sprintf(“gateId=%s&projectKey=%s”[“${gateId}”和“${projectKey}]”)
//将项目与gate关联的post
结果=httpRequest(
主持人:是的,
身份验证:“”,
contentType:“申请表”,
httpMode:'POST',
无知者:没错,
请求主体:“${body}”,
url:“http:///api/qualitygates/select"
)
groups.google.com/forum/#!forum/sonarqube会给你更多的关注,如果你认为你发现了一个错误,请不要在StackOverflow和google Group上交叉发布
{
"groupId": 53,
"groupName": "project-name-admin",
"permission": "admin",
"projectKey": "project-name"
}
// format post, sonarqube only knows form encoded
def body = sprintf("gateId=%s&projectKey=%s", ["${gateId}", "${projectKey}"])
// post to associate project with gate
result = httpRequest (
consoleLogResponseBody: true,
authentication: '<My Jenkins Credential>',
contentType: 'APPLICATION_FORM',
httpMode: 'POST',
ignoreSslErrors: true,
requestBody: "${body}",
url: "http://<sonarqube.url>/api/qualitygates/select"
)