Analyzing projects with GitLab CI/CD

Hi, I am having trouble to follow the “Analyzing projects with GitLab CI/CD”. My environment variables are set up but I am having trouble with “Configure your gilab-ci.yml file”.

Hi,

Could you describe what you’re trying & what the results are?

 
Ann

SonarQube version: 8.9.0.43852 Enterprise Edition.

Hi I am trying to implement the PR Decoration in Gitlab.

I already created the GitLab OAuth App, the AML integration, and I imported the projects into SonarQube. What I haven’t been able to accomplish is to analyze the projects with GitLab CI/CD. The environment variables are SET but the yml file not. I am trying to follow the steps as: GitLab Integration | SonarQube Docs but it gets confusing after “Analyzing projects with GitLab CI/CD”.

Hi,

Are your projects already being built in/by GitLab CI? If so, they should already have a yml file in place, and you would only need to add the SonarQube configuration to it.

 
Ann

I was able to solve the issue.

Now I have a question regarding the Environment variables.

Is there any way that those variables get inherited from an instance and call them from the yml file? Or this can just be set up at the project level.

Hi,

According to the docs it looks like you need to set them at the global level, which is what I believe your screenshot shows.

 
Ann

Thank you. I guess my question goes to if we can call the global environments in the yml file for sonarqube-check, if the have been set at the global level?

We are trying to get as automated as possible, and although GitLab docs specify that those variables can be added as instance, when a new group is created those variables aren’t getting inherited. Those variables can manually be added to the new group and then those subgroups are inheriting them.

Hi,

I don’t have direct experience with this, but from what I’m seeing from the docs, you don’t need to. Or if you do, that’s already in the yaml snippet you’re given(?).

 
:woman_shrugging:
Ann

Yeah, I believe the same. Not sure why gitlab is not inheriting the variables in the new groups.

Thank you so much!