Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request support for SonarQube #147

Open
Amelia-Gwen opened this issue Apr 27, 2019 · 2 comments
Open

Request support for SonarQube #147

Amelia-Gwen opened this issue Apr 27, 2019 · 2 comments

Comments

@Amelia-Gwen
Copy link

SonarQube supports webhooks for their analysis. According to their documentation payloads are in .json format and an example would look like this:

{
    "analysedAt": "2016-11-18T10:46:28+0100",
    "project": {
        "key": "org.sonarqube:example",
        "name": "Example"
    },
    "properties": {
    },
    "qualityGate": {
        "conditions": [
            {
                "errorThreshold": "1",
                "metric": "new_security_rating",
                "onLeakPeriod": true,
                "operator": "GREATER_THAN",
                "status": "OK",
                "value": "1"
            },
            {
                "errorThreshold": "1",
                "metric": "new_reliability_rating",
                "onLeakPeriod": true,
                "operator": "GREATER_THAN",
                "status": "OK",
                "value": "1"
            },
            {
                "errorThreshold": "1",
                "metric": "new_maintainability_rating",
                "onLeakPeriod": true,
                "operator": "GREATER_THAN",
                "status": "OK",
                "value": "1"
            },
            {
                "errorThreshold": "80",
                "metric": "new_coverage",
                "onLeakPeriod": true,
                "operator": "LESS_THAN",
                "status": "NO_VALUE"
            }
        ],
        "name": "SonarQube way",
        "status": "OK"
    },
    "serverUrl": "http://localhost:9000",
    "status": "SUCCESS",
    "taskId": "AVh21JS2JepAEhwQ-b3u"
}
@Zomis
Copy link
Owner

Zomis commented Apr 27, 2019

Given this payload, what do you propose @DugaBot should write in chat?

@Amelia-Gwen
Copy link
Author

If the scan fails I suggest @DugaBot announces:

{project: name} **SCAN FAILURE!**

Similar to announcements for build failures. I believe this is what is indicated by the {status} key.

If the scan completes successfully then announce:

{project: name} scan completed successfully. Quality Gate status: {qualityGate: status}

And if the quality gate fails display each of the conditions that failed

{metric} failed: {value} is not {operator} {errorThreshold}

There should always be a quality gate. I will continue to examine their interface to determine if there is an workaround for having no gate, but I believe they designed it to not be allowed. The default gate cannot be deleted the way user defined gates can be and you cannot select no gate or equivalent. Creating a gate, assigning it, and deleting it reverts to the default gate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants