Trigger a project pipeline based on the commit to another parent project


I have hosted sonarqube on an EC2 instance from the bitnami AMI and integrated it with GitLab to analyze source projects using the sonar-gitlab plugin. I have a project (Project A) with the gitlab ci yml file containing sonar scanner image, sonar url and other specifics. Also, there is file with projectkey and sources pointing to current directory, and a python file for analyzing the code. This setup works perfectly fine.

There is another project (Project B) with actual code which I would like to analyze whenever there is a commit to the master branch using Project A, the challenge is I should not change anything in the Project B like adding a stage or trigger.

I have tried to change the sonar.sources to point to the URL of Project B and specifying sonar.projectDir but nothing seems to work. Any insight or suggestions on how to get this working is appreciated.

Sonarqube - bitnami-sonarqube-
Sonar-gitlab plugin - 4.1.0-SNAPSHOT



You can’t accomplish this on the SonarQube side. You need to handle it on the CI side. Presumably you’ll add a step in the Project A job/pipeline to trigger Project B.


I see. Suppose I add a bridge job in project A to trigger project B, can the sonar properties (base URL, project dir, etc.) be setup in project B to analyze the code in project A? This is what I am trying to achieve.

Thank you,


The code and the properties file need to be in the directory you’re kicking analysis off from. If you tried really hard you could make it work but it would be a terrible kludge and ultimately painful to maintain. If the code is checked out into Project A then Project A needs to run the analysis.