qualinsight-plugins-sonarqube-badges
qualinsight-plugins-sonarqube-badges copied to clipboard
resolve gitlab badges with project_path variable as key
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