QualInsight / qualinsight-plugins-sonarqube-badges

Plugin for SonarQube that generates badges displaying information about a project's or view's quality.
GNU Lesser General Public License v3.0
110 stars 141 forks source link

resolve gitlab badges with project_path variable as key #81

Closed steventong closed 7 months ago

steventong commented 5 years ago

Gitlab support group badges but only has 4 variables.

We have several projects under group, like 'Server/aaa-service', 'Server/bbb-service','Server/middleware/ccc-service'.

Gitlab only give us project_path but we want get project_name which are same as sonarQube project key. And Sonarqube does not support '/' as one of project key yet. We also do not want to set badges as project level.

So I add a parameter called 'gitlab', when pass it to 'ture', the 'key' will split with '/' and get the last node as project key. It is quite simple.

So I will give some examples:

https://sonar.example.com/api/badges/measure?key=Server/aaa-service&metric=coverage&gitlab=true -> https://sonar.example.com?id=aaa-service

https://sonar.example.com/api/badges/measure?key=Server/Subgroup/aaa-service&metric=coverage&gitlab=true -> https://sonar.example.com?id=aaa-service