I am developing some tool to sync permission between sonarqube and gitlab, it will use sonarqube’s api and gitlab’s api. when use sonrqube’s api, I get a list of project, then I need to get information about these projects in gitlab, when using gitlab’s api I need project’s id or full path. but for projects imported from gitlab in sonarqube, it’s hard to get gitlab project’s id or full path.
If we can decode the integer id from generated project key, then there is no need to parse group/project paths.
for example, below is a project’s generated key:
hexin_IBP-group_IBP_AXxe92rXcK0-zIKzZHBZ
in our hosted gitlab, it’s a project named IBP under group /hexin/IBP-group/, it’s integer id in gitlab is 1026, of course I can parse group/subgroup/name from the path, but if I can decode project 's integer id from the generated part AXxe92rXcK0-zIKzZHBZ, it’s more easy and reliable. because there can be manually created projects in sonarqube, with uncertain project keys.
something even worse, I found in gitlab you can use _ in group/project name, while sonarqube use _ as the path seprator in genrated project key, make it harder to parse…
Can you give more details about the problem you’re facing (what issue are you trying to solve)? The more details (screenshots, examples, explanations) the better. Right now, it’s hard to know what you’re talking about.
This is a community forum and sometimes it takes time to respond. Bumping topics after less than a day is not appropriate in this Community. Read more in our FAQ
I can confirm that it’s not possible to derive the project ID from the UUID that’s tacked on at the end of the project key… but honestly, I’m a bit surprised that we chose to use a random UUID rather than this ID.
I’m not sure what your goal is in parsing out the information, but since you’re using Project Onboarding, you should be able to use GET api/alm_settings/get_binding in order to get the project ID.