SonarQube 6.7 LTS group permissions API doesn't working

Viewed 400

I'm migrating SonarQube from 5.6 version to 6.7. I'm using SonarQube API with my Jenkins jobs and the problem is the API for groups permissions isn't working with 6.7 version...

I've tried manually with Postman (POST raw JSON) this :

{
    "groupName": "project-name-admin",
    "permission": "admin",
    "projectKey": "project-name"
}

The result returned is :

{
    "errors": [
        {
            "msg": "Group name or group id must be provided"
        }
    ]
}

And it's the same if I use :

{
    "groupId": 53,
    "permission": "admin",
    "projectKey": "project-name"
}

or

{
    "groupId": 53,
    "groupName": "project-name-admin",
    "permission": "admin",
    "projectKey": "project-name"
}

It's working with 6.5 verison and I've no idea where this problem may come from :(

@SonarQube developers team : can you fix thaaaat please ?

2 Answers

This is a piece of code to assign a project to a gate, using authentication and post. Mind the body and content-type!

// 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"
)
Related