DevOps Automation

DevOps Automation

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.


#DevOps
 View Only
Expand all | Collapse all

How to view SonarQube integration data on UrbanCode Velocity?

  • 1.  How to view SonarQube integration data on UrbanCode Velocity?

    Posted Mon April 03, 2023 03:37 AM
    Edited by Tung Vu Thanh Mon April 03, 2023 03:39 AM

    Hi everyone,
    I'm looking for a way to view SonarQube data on UrbanCode Velocity.

    I've created a SonarQube integration as below:


    Everytime SonarQube server finish scanning a specific project, it send a webhook to Velocity, and i got SonarQube integration's logs look like this:

    [2023-04-03T03:42:18.371] [INFO] VelocityPluginRunner - Found decryption key file
    [2023-04-03T03:42:18.391] [INFO] sonarqube-callback - Received SonarQube Callback - Asset Management
    [2023-04-03T03:42:18.391] [INFO] sonarqube-callback - Received SonarQube webhook Responce - {"serverUrl":"http://localhost","taskId":"AYdFLtoRj1xnrgooOZBu","status":"SUCCESS","analysedAt":"2023-04-03T10:34:59+0700","changedAt":"2023-04-03T10:34:59+0700","project":{"key":"demo.vtt.clgsp:asset-management","name":"Asset Management","url":"http://localhost/dashboard?id=demo.vtt.clgsp%3Aasset-management"},"branch":{"name":"master","type":"LONG","isMain":true,"url":"http://localhost/dashboard?id=demo.vtt.clgsp%3Aasset-management"},"qualityGate":{"name":"VNPT-IT Gates","status":"WARN","conditions":[{"metric":"security_rating","operator":"GREATER_THAN","value":"4","status":"WARN","onLeakPeriod":false,"errorThreshold":"4","warningThreshold":"2"}]},"properties":{}}
    [2023-04-03T03:42:18.855] [INFO] sonarqube-callback - coverageUrl: http://codequality.devops.demo/api/measures/search_history?metrics=uncovered_lines,lines_to_cover&component=demo.vtt.clgsp:asset-management&from=2023-04-03T10:34:59%2B0700&to=2023-04-03T10:34:59%2B0700
    [2023-04-03T03:42:18.904] [INFO] sonarqube-callback - coverageData returned from API: {
      "paging": {
        "pageIndex": 1,
        "pageSize": 100,
        "total": 1
      },
      "measures": [
        {
          "metric": "lines_to_cover",
          "history": [
            {
              "date": "2023-04-03T10:34:59+0700",
              "value": "1462"
            }
          ]
        },
        {
          "metric": "uncovered_lines",
          "history": [
            {
              "date": "2023-04-03T10:34:59+0700",
              "value": "198"
            }
          ]
        }
      ]
    }
    [2023-04-03T03:42:18.904] [INFO] sonarqube-callback - num and deno: {
      "numerator": 1264,
      "denominator": 1462
    }
    [2023-04-03T03:42:18.904] [INFO] sonarqube-callback - coverageDataDoc: {
      "tenantId": "5ade13625558f2c6688d15ce",
      "application": {
        "external_id": "AYcNMmr5j1xnrgooOPbs",
        "name": "Asset Management"
      },
      "dataSet": "SonarQube",
      "record": {
        "recordName": "Asset Management - Coverage Metrics (2023-04-03T10:34:59+0700)",
        "pluginType": "sonarqube callback",
        "dataFormat": "json",
        "metricDefinitionId": "COVERAGE_LINES",
        "entries": [],
        "value": {
          "numerator": 1264,
          "denominator": 1462
        }
      }
    }
    [2023-04-03T03:42:18.905] [INFO] ucvClient - Initializing API Client for Sonarqube plugin

    But now i don't know how to view data I got with this integration?
    I've tried to add this integration to value stream mapper

    And then add some related metrics, but nothing show up.

    Do you have any idea how to use this kind of data? 
    Thank for your time!



    ------------------------------
    Tung Vu Thanh
    ------------------------------



  • 2.  RE: How to view SonarQube integration data on UrbanCode Velocity?

    Posted Tue April 11, 2023 05:00 AM

    Hello,

    The way this integration works is that the sonarqube scan results are uploaded into Mongo linked to the build version - typically a build URL. And the data is presented in a insights chart or a KPI on the metric bar.
     
    So…
    Was the sonarqube data successfully uploaded to Mongo and was it properly linked to a build inside Mongo? I don't see a dot in the build stage which is suspect.
    Meaning, we would need to look at the mongo repo or logs from the synchronization which should be available as an option on the hamburger icon.



    ------------------------------
    Osman Burucu
    Product Manager UrbanCode Family
    IBM
    Vienna
    00431211454746
    ------------------------------