Monorepo: how to add subprojects automatically to the parent project when a build is triggered

Hi, I have a monorepo, using GH actions to push the analysis to the Cloud. Here is the code: testcontainers-go/.github/workflows/ci-test-go.yml at 467678c5cb92fbf84c02359ed340c986dba96e93 · testcontainers/testcontainers-go · GitHub

The GH action that pushes the results fails with this error:
Link: fix: pass secret to the reusable workflow (#3034) · testcontainers/testcontainers-go@467678c · GitHub

17:15:28.564 ERROR Could not find a default branch for project with key 'testcontainers_testcontainers-go_modules_kafka'. Make sure project exists.
  1. the parent project already existed
  2. I was updating from a deprecated GH action to the new scan action
  3. As a user, I’d have expected the subprojects would be automatically created, but it results that they are not.

Do you see this setup is incorrect?

In the monorepo, there are +50 submodules, and I don’t want to create them manually.

I’ve verified that creating one of them manually, the sonar scan works perfectly fine (see SonarQube Cloud), but it’s not aggregating that submodule under the parent.

I’m not sure if this is possible, but as a user, I’d like to have a parent project, and the submodules below it.

I “manually” created the projects in SonarCloud using the REST APIs:

curl -v -X POST https://$TOKEN@sonarcloud.io/api/projects/create -d “name=$NAME&project=$PROJECT&organization=$ORG”

It’s not ideal for the creation, but I still miss the parent-child representation in the UI.

I’d like to know if I configured something wrong on my end.

Thanks in advance

Hi,

This simply isn’t how our monorepo support works. Each project in a monorepo is assumed to be an independent project.

 
HTH,
Ann

Thanks G Ann Campbell for the info, now it’s clear how it works.

Although, as a user, I’d like to see the parent/child relationship in this kind of cases, thanks!

1 Like