Search code examples
sonarqubesonar-runnersonarqube-scansonarqube-web

how to configure the "leak period" based on a custom measure


I'm using sonarqube 6.2. We increment version number on every build, and sonarqube analyzes every build. Not every build goes into production environment, however.

I need to configure the leak period to compare the latest build against the latest version released in production (so not necessarily the previous version, or previous analysis, or "x" days...).

I thought I could create a custom measure (e.g. "is_released") to identify which version is in production, but then how do I configure the leak period to use this field (compare the current build against the latest version that "is_released")?


Solution

  • You can't configure the Leak Period based on a custom measure.

    At this stage I'd suggest using the SonarQube Web API. Get the info (from your external systems) about which versions are released in prod' for project foo and set it accordingly in SonarQube (e.g. with api/properties):

    curl -u admin:admin -X POST "http://your_sonar_host/api/properties?resource=foo&id=sonar.timemachine.period1&value=v1.5.2"

    Note: api/properties is about to be replaced by api/settings in upcoming SonarQube v6.3 .