7.9 LTS Integration with Gitlab and Gitlab Pipeline

  • Sonarqube 7.9 LTS

We are creating a Gitlab Pipeline, and whenever there is a git commit we are able to send the project to Sonarqube using .yml file. In the pipeline, if the Quality Gate has failed the pipeline will fail, and if Quality Gate has passed pipeline will be a success. The problem is that, we cannot get any information about the project that if the Quality Gate has passed or not. How can we learn if the Project Quality Gate has passed in Gitlab?

There is a plugin ‘Sonar GitLab Plugin’ but it only works with only SQ <7.7. That plugin I assume works for our needs however we don’t want to use a previous version of SQ. So how can we best integrate Gitlab with Sonarqube?

Hi,

I don’t have a good answer for you. We don’t currently offer any GitLab integration, although that may change. In the meantime I can only point out that a webhook might be use useful, altho I have no idea what exists on the GL side to catch and process such a call.

 
HTH but afraid it doesn’t,
Ann

It would have been better if Sonarqube had Gitlab support but we solved the problem by using Web API of Sonarqube. We get the project quality gate and errors from API, and fail the pipeline if quality gate failed. We still have some issues like waiting for project analyzing to finish, however in overall it seems to work fine.

Webhook looks useful but unfortunately Gitlab doesn’t support receiving it.

Hello @eraytufan, i’m trying to get gitlab working wih sonarQube as you was previously trying to do.

Can you detail your gitlab configuration to make it work via sonarQube WebAPI ?

Thank yo so much

@loclamor I don’t have the code right now, but in Gitlab runner we used a token for Sonarqube to access the Sonarqube Web API. From the API, we got if quality gate has passed, how many issues are there etc. After that depending on the result we passed or failed the pipeline.