Scanner not finding files in CI/CD only -> "The main branch of this project is empty"

Hi all,

I am trying to introduce sonarqube to our pipeline but having some problems when trying to automate and run as part of our pipeline. I tested first locally and worked fine. Once I moved to the pipeline we have, I started having some problems. Every time I am running from my CI/CD, I am getting this message in my sonarqube project The main branch of this project is empty. .

I run a number of tests and could not make it work from the CI/CD at all, just from my local. Once I run using “-X”, I noticed small difference:

local (working)

00:58:07.362 INFO: Analyzing 5 typescript file(s) with the following configuration file /xyz/xyz/xyz/tsconfig.json
00:58:07.387 DEBUG: Starting external process node --max-old-space-size=2048 /xyz/xyz/xyz/.scannerwork/sonarts-bundle/node_modules/tslint-sonarts/bin/tsrunner
00:58:24.662 INFO: 5 files analyzed out of 5
00:58:24.921 INFO: Sensor SonarTS [typescript] (done) | time=18885ms

Ci/CD (nor working)

14:25:17.605 INFO: Analyzing 5 typescript file(s) with the following configuration file /abc/abc/abc/tsconfig.json
14:25:17.620 DEBUG: Starting external process node --max-old-space-size=2048 /abc/abc/abc/.scannerwork/sonarts-bundle/node_modules/tslint-sonarts/bin/tsrunner
|14:25:17.783 INFO: Sensor SonarTS [typescript] (done) | time=369ms|

As you can see, when running from my CI/CD, it doesn’t show the message about the 5 files analysed.

Is there anything we missing here ?

Thanks in advance,
Luiz

Hi Luiz,

Welcome to the community!

That 5 files analyzed... message is about the speed of analysis on the two machines. As each language is analyzed, there’s a timer for the language that emits a progress report every n seconds (I don’t remember exactly how many). The fact that you’re seeing 5... out of 5 on your localhost, means it’s a little slower (or has more going on) than your CI agent.

Your empty main branch relates to something else. You didn’t mention which edition you’re using. Could it be that you’re accidentally analyzing as a non-main branch?

 
Ann

Sorry for taking a bit long to reply this one but I found the issue, my project was missing a node_module that was required for the test. Once I updated and log a bit more info I found the issue. It is working now :slight_smile:

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