Extend the projectKey to more than 63 characters

Hello,

Is there a way to extend the projectKey value to more than 63 characters ?

All sonarqube analysis are made from gitlab CI pipeline so we use the variable CI_PROJECT_PATH_SLUG to generate the key.

sonar.projectKey=${env.CI_PROJECT_PATH_SLUG}

The path is important for us because it helps us to map the access rights between gitlab and sonarqube using permission template.

The gitlab path is made like this :

<root>/<business unit>/<subgroup>/<project>/<other sub group sometimes>

We have one sonarqube user group per <root>/<business unit>/<subgroup> with the good permissions template associated.

The problem is that for some project we get a duplicate key for multiple projects because the name was truncated because of the 63 characters limit.

We are actually using sonarqube 9.X.

Thanks for your help/advice

Hello @GuillaumeDS ,

Welcome to SonarSource Community! :sonarsource:

That 63 character limit on CI_COMMIT_REF_SLUG is from GitLab (as shown here), not SonarQube. In fact, there are some GitLab tickets that want to reduce that character limit, see Gitlab CI: Truncate variable names in the environment section (#24659) · Issues · GitLab.org / GitLab · GitLab.

SonarQube has a 400 character limit on project key:

Please create a GitLab issue for this suggestion for extending the CI_COMMIT_REF_SLUG character limit, if that is what you desire.

Joe

1 Like

Hello

Thanks for your reply, in fact I was talking about CI_PROJECT_PATH_SLUG not CI_COMMIT_REF_SLUG .

But both are limited to 63 characters, even if it’s not show in gitlab documentation.

Thanks for your help

1 Like

Oops my mistake, thanks for the correction.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.